Tuesday, 14 April 2015

How to increase session timeout in ASP.NET?


In this article I will explain how to increase the session timeout in ASP.NET.

You can increase the session time-out in ASP.NET in mainly three following ways in IIS 7 Version.

Method – I:

First open up IIS

Select your website.

Click on Session state on the right

Now enter your session timeout under the cookie settings

Method – II:

Open up your web.config file and under the system.web section add the following:

<sessionState timeout = "20" mode = "InProc" />

Replace 20 with whatever number you wish.

Ex: <sessionState timeout = "60" mode = "InProc" /> // 1 Hour

Method – III:

            Open Global.asax file in your web site.

Under the Session_Start method, set the timeout property of the session to the required value like this.


Session.Timeout = "60";


No comments:

Post a Comment