Error while adding new section using AddElement

Jul 23, 2009 at 6:46 AM

Hi,

I want to add following assembly redirection section in web.config file inside "configuration" element.

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
         <assemblyIdentity name="assemblyName" publicKeyToken="7a327b92aa33d408" culture="Neutral" />
         <bindingRedirect oldVersion="8.1.2.1" newVersion="9.0.0.2" />
         </dependentAssembly>
      </assemblyBinding>
 </runtime>

I am trying this with XmlFile.AddElement nut I am getting following error.

error: Message = Expression must evaluate to a node-set.

If anyone has tried with this, I will really appreciate if you share your example with me.

Thank you,
Shashi