How to increase session timeout period in asp.net

Introduction: In previous articles i explained How to remove sessions in asp.net. and  Delete confirmation before delete Or Yes/No confirmation in asp.net and How to generate random number in asp.net and 
How to check whether email address valid or not in asp.net and How to Encrypt connection string in web.config | How to Decrypt connection string in web.config.

  By default session timeout is 20 minutes but sometimes it is required to increase or decrease the session timeout as per application requirement. It is possible by a simple setting in the web.config file.

let's say we have to  increase session timeout to 1 hour then make changes in the web.config files as:

  • open your web.config file and add
<system.web>
<sessionState timeout="60"></sessionState>
</system.web>

OR

<system.web>
 <sessionState mode="InProc" cookieless="false" timeout="60" />
</system.web>

OR
<system.web>
<sessionState
    mode="InProc"
    stateConnectionString="tcpip=127.0.0.1:42424"
    stateNetworkTimeout="60"
    sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
    cookieless="false"
    timeout="60"/>
</system.web>

Previous
Next Post »

1 comments:

Click here for comments
Unknown
admin
July 23, 2015 ×

what is difference between these method

Congrats bro Unknown you got PERTAMAX...! hehehehe...
Reply
avatar

If you have any question about any post, Feel free to ask.You can simply drop a comment below post or contact via Contact Us form. Your feedback and suggestions will be highly appreciated. Also try to leave comments from your account not from the anonymous account so that i can respond to you easily..