Alberto,
I am not sure if this is a bug in .NET, but we have found that we cannot
write to the app.config file either. We have found a work around though.
In your main App.Config you would point to another config that you are
allowed to make changes to.
Example: (App.Config)
<configuratio n>
<appSettings file="NewApp.co nfig"></appSettings>
</configuration>
Example: (NewApp.Config)
<?xml version="1.0" encoding="utf-8"?>
<appSettings>
Put all of your app settings in here
</appSettings>
------
Now if you make changes to NewApp.Config you have to close and restart the
application in order for the new settings to take effect.
Hope this helps. If anyone has a better solution to this please let me
know.
Sincerely,
Shannon
"Alberto" <ańsk********@a sdf.eswrote in news:O$6P4$YWHH A.4796
@TK2MSFTNGP05.p hx.gbl:
I have a app.config file and I'd like to read and modify strings in it.
I can read but I can't modify strings. The code I'm using is this:
System.Configur ation.Configura tion config =
ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.None);
string key = "myKey";
config.Save(Con figurationSaveM ode.Modified);
Configuration.M anager.RefreshS ection("appSett ings");
What's my mistake? Thank you very much