writing to the config file using enterprise lib 3.1 and Configuration Manager

Jun 17, 2008 at 7:54 PM
Hello,

I have a question -- I want to write to web.config file using enterprise library 3.1 and Configuration Manager.

I installed Enterprise library 3.1 but I can;t find the Microsoft.Practices.EnterpriseLibrary.Configuration.dll  which contains the ConfigurationManager class.

I know that  Enterprise library 3.1 ... makes use of the configurationManager class from System.Configuration.dll but How do I write to the web.config

If anybody can tell what api's are available for writing/reading from the web.config source I will really appreciate that.

earlier I was able to do this -- 

ConfigurationManager.WriteConfiguration("SomeClass

",objectofthatclass);

Thanks,
Yash

 

Jun 17, 2008 at 8:37 PM
You should be able to retrieve a Configuration object using the WebConfigurationManager and save it after updating it. I haven't tried modifying a web app's config file from within the app though, and it will probably cause the app to restart. To avoid this you can store configuration in a different file using the configSource property.

Hope this helps,
Fernando


yashwant wrote:
Hello,

I have a question -- I want to write to web.config file using enterprise library 3.1 and Configuration Manager.

I installed Enterprise library 3.1 but I can;t find the Microsoft.Practices.EnterpriseLibrary.Configuration.dll  which contains the ConfigurationManager class.

I know that  Enterprise library 3.1 ... makes use of the configurationManager class from System.Configuration.dll but How do I write to the web.config

If anybody can tell what api's are available for writing/reading from the web.config source I will really appreciate that.

earlier I was able to do this -- 

ConfigurationManager.WriteConfiguration("SomeClass

",objectofthatclass);

Thanks,
Yash