I'm working on asp.net project. how can I increase the session timeout? (infinity timeout) Or should I do this on IIS? If it is possible, please explain.
-
set a session cookie with far future expire date. – Sain Pradeep Jul 06 '15 at 06:58
3 Answers
You can set session timeout
in web.config
as shown below. The value is showing minutes, so you can set as long as you want, up until a year.
<configuration>
<system.web>
<sessionState timeout="200"></sessionState>
</system.web>
</configuration>
The Timeout property can be set in the Web.config file for an application using the timeout attribute of the sessionState configuration element, or you can set the Timeout property value directly using application code.
The Timeout property cannot be set to a value greater than 525,600 minutes (1 year). The default value is 20 minutes.
-
Thank you for you answer.. If you know please explain.. How can I do same on IIS – Buddhika Samith Jul 06 '15 at 07:17
-
You write in your web.config file, it will automatic configure your IIS because web.config is Configuration file for application.. – Shirish Jul 06 '15 at 07:20
You cannot assign it to unlimited. You can increase the value in minutes using the time out attribute of Session state element in web.config
<sessionState timeout="30">
</sessionState>
By default session timeout value is 20 minutes. Also in your case if you are using forms authentication, check the authentication time out value as well
<authentication mode="Forms">
<forms loginUrl="logon.aspx" protection="All" path="/" timeout="30" />
</authentication>

- 95
- 1
- 10
one way is by setting the timeout in web.config file. Like
<configuration>
<system.web>
<sessionState mode="InProc" timeout="120"/>
</system.web>
</configuration>
The other way is by setting the time-out in server side code in .cs file. Like
Session.Timeout = 100;
The time-out value entered will be read as minutes. If set to 0, then there will be an error page displaying session time-out value cannot be 0 and must be >0.

- 95
- 1
- 11