Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Saving a configSection from code, preventing restart


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?

Apr 28, 2009 16:12

Take a look here: 

Apr 28, 2009 16:39

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.

Apr 28, 2009 18:54
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.