I am unable to save modification of ' app.config ' file.

Here is the code.

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

config.AppSettings.Settings["MDI"].Value= "1";


config.Save( ConfigurationSaveMode.Full );
ConfigurationManager.RefreshSection("appSettings");


There is no issue of reading app.config file. I am reading proper values .But if changed it ,it is not updating the file.
And I have also changed order of RefreshSection() and Save() function but hopeless.

Can anyone help to resolve this issue?

Writting into .config file is not a good idea.
The config files are intended to give administrators a way to configure
certain settings and not to persist settings.
They reside (normally) under program files folder thus only admin (if not
set otherwise) can edit them.

If you have settings that you need to persist consider storing them in
user-specific or app-specific area.

If changing the app.config, the application will need to restart or you will need to execute it from an Xml/XDocument in order to apply the change to your current "session"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.