How To Increase Session Timeout In Asp.Net
Asp.Net Session are used to store and retrieve data when the user navigate from one page to other.
That means, when a user needs some information from current page that can be used in another
page, then that information can be assigned to Session and the information can be retrieved from
Session when the user navigate to the other page.
Session Object are initialized when the user stores some information in Session Variable or when the
user initialize the Session_Start method on Global.asax page. If the page is inactive for a particular
period of time (by default 20 minutes), then the Session will not be active. We can increase or decrease the Session timeout so that the Session Object can be active as per out requirement.
We can Change the Session Timeout In Three ways.
Change Session Timeout via IIS.
Change Session Timeout via web.config.
Change Session Timeout via Global.asax.
Open your IIS and go to your website.
On Features View Click on Session State Icon under Asp.Net category.
Scroll down to Cookie Settings.
Here you can change the Session Timeout as shown in the figure.
Open the web.config of your web application.
Under system.web node, provide the following code.
You can increase or decrease the timeout as per our requirement.
Open the Global.asax file of your application.
Include Session_Start method on the Global.asax page.
Append the timeout code as shown below.
Session.Timeout = "70";
By this way, we can Increase the Session Timeout In Asp.Net.