title: programmatically add dependentAssembly to runtime\assemblyBinding
body: <p>I am trying to add a new dependentAssembly to my Web.config file at run time. So far my current code has</p>
  
  <pre><code>    XmlNamespaceManager manager = new XmlNamespaceManager (WebConfigDoc.NameTable);
      manager.AddNamespace("bindings", "urn:schemas-microsoft-com:asm.v1");
  
      XmlNode root = WebConfigDoc.DocumentElement;
  
      XmlNode assemblyBinding = root.SelectSingleNode("//bindings:assemblyBinding", manager);          
  
      XmlNode newAssemblyBinding = WebConfigDoc.ImportNode(GetElement(MyNewNode()), true);
  
      assemblyBinding.AppendChild(newAssemblyBinding);    
  }
  
  private string MyNewNode()
  {    
      string Node = "&lt;dependentAssembly&gt;" +
                    "&lt;assemblyIdentity name=\"newone\" "+
                    " publicKeyToken=\"608967\" /&gt;" +
                    "&lt;bindingRedirect oldVersion=\"1\" newwVersion=\"2\" /&gt;" +
                    "&lt;/dependentAssembly&gt;";
      return Node ;  
  }
  </code></pre>
  
  <p>This works but the result node is this</p>
  
  <pre><code>&lt;dependentAssembly xmlns=""&gt;
      &lt;assemblyIdentity name="newone" publicKeyToken="608967" /&gt;
      &lt;bindingRedirect oldVersion="1" newVersion="2" /&gt;
   &lt;/dependentAssembly&gt;
  </code></pre>
  
  <p>I dont need the <code>xmlns=""</code> attribute to be appended.</p>
  
  <p>Is there a better way to do this?</p>
  
  <p>Thanks.</p>