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):
But don't forget that any change to web.config causes the
web application to restart. All users lose their session state.
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.