Is there a way to write to web.config through code?

C

Christopher Ambler

That's pretty-much sums it up.

I've got an application that stores configuration values in the appSettings
area of the web.config, and I'd love to be able to make a page that allows
an authenticated user to make changes to those configuration options.
Everything seems to be read-only, though. I'd hate to use a database... that
would be overkill.

Thanks in advance!

Christopher
 
M

Marina

Every time web.config is modified the app restarts - so every time you wrote
to it, this would happen. That is probably one of the reasons there are no
built in methods to write to it.

However, you can load the file into an XML dom, change the settings manually
(without the convenient write methods you seem to be looking for), and then
save the XML back to the file.
 

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top