This post shows how to update (add, edit or remove) AppSettings
and custom config sections in App.config
at runtime.
App.config file
Sample App.config
file:
Update AppSettings
Add a new key
Edit an existing key's value
Delete an existing key
Update custom configuration sections
Add a new key
Edit an existing key's value
Delete an existing key
Print out all keys
References
- Modifying app.config at runtime throws exception
- update app.config file programatically with ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
- Opening the machine/base Web.Config (64bit) through code