how to increase session timeout in asp.net?

asp.net

Solution

You can increase the session time-out in asp.net in any one of the following ways

Using IIS Version 7 :

- Open up IIS

- Select your website from the list of sites

- Click on Session state on the right

- Now enter your session timeout under the cookie settings

OR

Web.config : 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.

OR

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

Session.Timeout = "20";

Note : If you are setting a session timeout in both IIS as well as web.config, then the one in IIS will override the one in web.config

Hope this helps!

Problem

I tried following codes to increase session timeout, but no use, code is: ``` <sessionState mode="InProc" cookieless="true" timeout="60"> </sessionState> ``` Also code at ``` void Session_Start(object sender, EventArgs e) { // Code that runs when a new session is started Session.Timeout = 15; } ```

Original source

Related problems