I am trying to work out a way to alter the session timeout dynamically, as my customer has requested that this be a value they can easily change (as though it were a database transaction). Here is a truncated version of the value I am trying to change:
<appSettings>
<add key="SessionTimeout" value="20"/>
</appsettings>
I’m working with C#/.Net 3.5 with all of this.
For the record, I am aware that altering the web.config file will cause a restart of the application. What I am going for is to give the administrator of the program the ability to alter the timeout on the fly. If, for example, one of the forms they are requiring people to fill out is taking longer than 20 minutes, and they need to bump the time up to a half hour, or if they want it shortened for some other reason. Since we want to keep the users (including admins) out of the code files, the goal is to create this as part of the site’s admin page.
The problem is, I have no idea how to do this, or if it’s even possible (much less a good idea). I’ve given google the run around and come up with nothing.
Is there a way to make these alterations, or even potentially to dynamically change the timeout on the fly (overriding the contents of the web.config)?
Thanks for the help.
Instead of trying to change web.config, how about changing Session.Timeout in code at runtime ?
More info :
http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout.aspx