Reputation: 3967
I have user log in logic in my web app. after successful log in, i set the user id in Session, so i can keep track of the user. and in my master file page load event, i do
Session.timeout = 60
so session should timeout after an hour. but my session times out at around 10 - 20 minutes. What am i doing wrong? i bet it's obvious.
Upvotes: 3
Views: 1216
Reputation: 28248
If your app is crashing and re-starting at all, your sessions will be lost.
I'd setup some Health Monitoring and setup a notification for your app re-starting. If it happen more often than your 20 minutes then something is crashing your app.
Upvotes: 1
Reputation: 73564
Have you tried setting it in your web.config instead of server side code?
<configuration>
<system.web>
<sessionState
mode="InProc"
cookieless="true"
timeout="60" />
</system.web>
</configuration>
Upvotes: 1
Reputation: 65391
It is probably due to your IIS settings. In IIS the default timeout for a session is 20 min.
Use the IIS manager to change it.
Upvotes: 4