Session Timeout extend in Asp.Net

2019-08-18 19:25发布

问题:

How to extend the session timeout? I tried entering:

Session.Timeout = 720;

In formLoad and also tried in webconfig:

<system.web>
    <sessionState 
     mode="InProc"
     cookieless="true"
     timeout="720" />
</system.web>

But still it times out after 10 minutes. Can anyone help about this issue?

回答1:

Take a look at this Microsoft Technet article. Check if it suits your needs.

<configuration>
  <system.web>
     <sessionState 
         cookieless="true" 
         timeout="20">
     </sessionState>
  </system.web>
</configuration>


回答2:

You might see this article, I haven't used it but a time ago I needed something like this to use in a webservice and I finished with another approach. It could be useful to you:

The Defibrillator: Keeping ASP.NET Session Alive Ad Infinitum