Hi,
I'm trying to read and write entries to the configuration file. I have no issues in reading entries using:
This will recall the entry in the appSettings portion of the DLL.config file.
However, I don't seem to be able to change this and write it back to file. The code I'm using is:
It reads the value of Key1 &it sets correctly, I have tried getting it to pop up in a message box and it appears to change. When I check the config file or restart the app then it resets and the new value is not saved.
Any ideas?
Dave
I'm trying to read and write entries to the configuration file. I have no issues in reading entries using:
var Value = ConfigurationManager.AppSettings["Key1"];
This will recall the entry in the appSettings portion of the DLL.config file.
However, I don't seem to be able to change this and write it back to file. The code I'm using is:
var NewValue = "NewTestValue";
ConfigurationManager.AppSettings.Set("Key1", NewValue);
ConfigurationManager.RefreshSection("appSettings");
It reads the value of Key1 &it sets correctly, I have tried getting it to pop up in a message box and it appears to change. When I check the config file or restart the app then it resets and the new value is not saved.
Any ideas?
Dave