Can you programmatically change session time in ASP.NET?

Is it possible to do this or the only way to configure it on IIS?

+6
iis timeout session
source share
3 answers

You generally edit the Session_Start method of the Global.asax file and set Session.TimeOut at any time convenient for you. You can do this elsewhere in your code.

+4
source share

you can, but will not override IIS settings (20 minutes by default) if you are in a shared hosting environment.

I use the use of SQL sessions , this will make the web application a little slower, but you have full control over the sessions, and if you update something in the application and the Compiler needs to compile the resources / classes again, the user will not be logged out .

Sessions will be stored in a special SQL database table.

+5
source share

If you are in a hosted environment and do not allow overriding the default IIS session timeout (as others mentioned in the comments), you can trick IIS to keep the session longer by using an iframe that updates the session and (sort of like keeping a live ping) for any the amount of time you need. I had this situation and I used this approach

ASP.NET redirection for session redirection

+1
source share

All Articles