-5

How to extend the session time automatically and how session cycle works in asp.net?

Raja Rajan
  • 9
  • 1
  • 1

3 Answers3

4

The Session State is extended when the user makes a request based on the unique string (provided that the session has not yet ceased). If the session time is expired, and a request is made based on the previous, then a new session will start and the form state (data that exists on form) will be submitted.

To extend the session state, go to your web.config file.

<?xml version="1.0">
<configuration>
 <system.web>
   <compilation debug="true" targetFramework="4.5" />
   <sessionState timeout="90" cookieless="AutoDetect" />
 </system.web>
</configuration>

The attribute

timeout="90"

sets a 90 minutes expiration time for the Session state. If there is no response within the time frame, the Session state is removed.

The attribute

cookieless="AutoDetect"

will store the unique string into the cookie, if the user does not have the cookie, it will utilize it within the url.

rbtLong
  • 1,542
  • 3
  • 14
  • 31
1

Please have a look at following

Session Timeout extend in Asp.Net

A must read if you are newb http://msdn.microsoft.com/en-us/library/ms972429.aspx

Community
  • 1
  • 1
1

another way to alert the user that session has expired
http://code.msdn.microsoft.com/AspNetAlertSessionExpire-c230a148

skhurams
  • 2,133
  • 7
  • 45
  • 82