Take a look here:
Thanks, it's a good FAQ item, however it does not really cover my issue. I want to be able to change the file from code (preferably using the Configuration classes, not by operating directly on the config file). The issue is how to save only the file associated with my config section (and not web.config) from code, or if values are instantly persisted to file when changed in my ConfigurationSection class.
If i create a config section in web.config, which resides in a separate file (by using the configSource attribute), can I write to this section from code and persist the changes?
It seems I can create read/write properties in my derived System.Configuration.ConfigurationSection class, but will set values be persisted? I only find a Save method for the System.Configuration.Configuration class, which I suppose would save the whole web.config and restart the application? Can I save just my section somehow, updating only my separate config file and avoiding a restart?