Asp.net session expires earlier

I have a user login login in my web application. after a successful login, I set the user ID in the session, so I can track the user. and in my main page page load event, I do

Session.timeout = 60

therefore, the session should expire in an hour. but my session lasts about 10-20 minutes. What am I doing wrong? I am sure this is obvious.

+3
source share
3 answers

This is probably due to IIS settings. In IIS, the default timeout for a session is 20 minutes.

Use IIS Manager to change it.

+4
source

Have you tried installing it in your web.config instead of server side code?

<configuration>
  <system.web>
    <sessionState 
      mode="InProc"
      cookieless="true"
      timeout="60" />
  </system.web>
</configuration>
+1

, .

I installed Health Monitoring and set a notification to restart your application. If this happens more often than your 20 minutes, then something is crashing your application.

+1
source

Source: https://habr.com/ru/post/1721344/


All Articles