Saturday, March 31, 2012

Web Config

Is there a way to write to the web.config file during the execution of the
application?Hi Claudio

The web.config file is a standard XML file so you should be able to
write to it by accessing it using the classes of the System.Xml
namespace. However, AFAIK none of the built-in configuration classes
provide you with direct write-access to the application configuration file.

I'd rather recommend you to store settings that need read/write access
in a dedicated configuration file. A simple library that I've written
ages ago (and still using in all my projects) can be found here
(contains the source plus a sample project):

http://www.evolvesoftware.ch/downlo...nfiguration.zip

hth, Philipp

Claudio wrote:

> Is there a way to write to the web.config file during the execution of the
> application?
Claudio wrote:
> Is there a way to write to the web.config file during the execution
> of the application?

It's possible.
I wrote an example to modify the list of users that are allowed access:
http://www.codeproject.com/aspnet/members.asp

But don't forget that any change to web.config causes the
web application to restart. All users lose their session state.

--

Jos Branders

0 comments:

Post a Comment