What is default session timeout in ASP.NET?
What is the default session timeout value in ASP.NET?
It is 20 Minutes according to MSDN
From MSDN:
Optional TimeSpan attribute.
Specifies the number of minutes a session can be idle before it is abandoned. The timeout attribute cannot be set to a value that is greater than 525,601 minutes (1 year) for the in-process and state-server modes. The session timeout configuration setting applies only to ASP.NET pages. Changing the session timeout value does not affect the session time-out for ASP pages. Similarly, changing the session time-out for ASP pages does not affect the session time-out for ASP.NET pages. The default is 20 minutes.
It depends on either the configuration or programmatic change.
Therefore the most reliable way to check the current value is at runtime via code.
See the HttpSessionState.Timeout property; default value is 20 minutes.
You can access this propery in ASP.NET via HttpContext:
this.HttpContext.Session.Timeout // ASP.NET MVC controller
Page.Session.Timeout // ASP.NET Web Forms code-behind
HttpContext.Current.Session.Timeout // Elsewhere
- The Default Expiration Period for Session is 20 Minutes.
- The Default Expiration Period for Cookie is 30 Minutes.
- Maximum Size of ViewState is 25% of Page Size