reloading app.config after writing
When I use this to write to my app.config file:
Configuration config =ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["Wachtwoord"].Value = "Test";
config.Save();
Configurat开发者_StackOverflow社区ionManager.RefreshSection("appSettings");
I can read it again. But when i close and restart the program, the value of "Wachtwoord" has changed again to the old value.
Does anybody how I could fix this?
Thanks
Are you sure that this has not been caused by Visual Studio overwriting your settings file when you build the project? The original settings file lives with your source code, whereas you run the application from your build output directory (e.g. bin\debug). You may be making changes to the copy in the build output directory when you run the application, which will make changes to the version there. When you rebuild the project, the settings file will be overwritten.
精彩评论