Change Web.config value programatically

M

mg

How can I change the value of "timeout" in Web.config

<sessionState timeout="20" />

in one deployed app (project A) from a method call in a
WebForm (C#) that's running in another deployed app
(project B) on the same server.
 
N

Natty Gur

Hi,

Web.config is XML file so if you got rights you can use XMLDocument to
open the fie and edit it. B U T, keep in mind that changing web.config
file cause your application to recycle.


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
N

Nick

This is really not recommended because as soon as you save the web.config to
the disk your whole application will recyle it self. You may want to create
a custom object and then use XmlSerialization to serialize the object to the
disk so that you can pull the object in at the start and write to it as
nessisary. This will not recyle you application, you also have total
control over this method.
 

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

Forum statistics

Threads
474,133
Messages
2,570,776
Members
47,334
Latest member
danialcarter

Latest Threads

Top