Search code examples
xmlsaveconnection-stringdocumentxmldocument

XML Config file XmlDoument.Save is not updating ConnectionString


I have a config file, in which i store ConnectionString. I want to physically change the connectionString by using XMLDocument. But after i change and Call XmlDocument.Save("DatabaseSetting.config"), it does not take effect. My Code is as below :

                    ConfigXmlDocument doc = new ConfigXmlDocument();
                    doc.Load("DatabaseSetting.config");
                    XmlNode ConStrinNode = doc.SelectSingleNode("/connectionStrings/add");
                    ConStrinNode.Attributes["connectionString"].Value = newString;
                    doc.Save("DatabaseSetting.config");

Any quick help will be appericiated.


Solution

  • Oh I got it!! The XML file IS updated in the bin folder. Sorry for bothering.