13 September 2013

How to increase session timeout period in asp.net

By default session timeout is 20 minutes, but sometimes If You want to increase or decrease the session timeout as per application requirement. It is possible by a simple setting in the web.confing file.

Increase Session timeout  [increase session timeout to  1 hour in web.config]

In web.config
<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>

No comments:

Post a Comment