Hi,
You cannot, it;s readonly. I had a link somewhere explaining the reasons
behind this. One is that the changes in it will affect all the users of the
app, not the particular user that did it.
If you need to store changing values you can use the registry or even better
create your own config file and store it in the user ApplicationData folder
: Environment.SpecialFolder.ApplicationData
See opennetcf.org library for a good implementation of a config like class.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alberto" <al*****@nospam.es> wrote in message
news:OW****************@TK2MSFTNGP05.phx.gbl...
I need to modify a value in the app.config file with this code:
System.Configuration.Configuration config =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.None);
string key = "Path";
string value = "New value";
config.AppSettings.Settings.Add(key, value);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings") ;
It doesn't write the file. Could you tell me how to do it?
Thank you