Last post Dec 18, 2014 10:34 PM by Fei Han - MSFT
Dec 18, 2014 06:42 AM|KeeEdwins|LINK
I have an external .config file. How can i read that file and makes changes to value in some of the "Add" tags in the AppSettings.
Any help or sample code.
Dec 18, 2014 06:46 AM|AidyF|LINK
Config files are just xml documents so load them into an instance of XmlDocument, find the nodes you want using SelectSingleNode and update as normal then save. There is nothing special about config files.
However config is supposed to be read-only, if you are making dynamic updates to the config file from your code you shouldn't be using appsettings in the first place, use something else like a database.
Dec 18, 2014 10:34 PM|Fei Han - MSFT|LINK
Thanks for your post.
As for your problem, you could refer to this post which shows how to update (add, edit or remove) AppSettings and custom config sections.
Hope it will be helpful to you.
This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,
Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you
completely understand the risk before retrieving any software from the Internet.