开发者

Session timeout after 30 minutes in asp.net

I store some information in Session but the Session gets destroyed each time. I don't know why this is happening. I am using IIS7.

This is the setting which I have made:

<sessionState cookieless="AutoDetect" mode="InProc" timeout="120" />

I am storing some information while the user is开发者_StackOverflow中文版 getting registering but my client complains that when he sits idle for 20-30 minutes the information is lost. I am running application in one custom defined application pool whose idle timeout is 20 minutes (in properties of app pool). Can that be the problem?

Secondly even though I have specified timeout to be 120 minutes but when I click on "Session state" icon in IIS7 it doesn't show 120 minutes anywhere. What can be the problem?

Update: In cookie settings in "Session state" in IIS7 I see timeout as 5 minutes for Asp_NetSessionId. Can that be the culprit?


Well if your application pool is being destroyed after 20 minutes then that would be a problem considering your session is inproc. Increase the timeout of the application pool to be 120 minutes


If you store your session InProc, then every 20 minutes the application will be restarted, and all the sessions are lost. Run the StateServer service and use

<sessionState mode="StateServer" timeout="120" />

in web.config. Then you don't care how often the app is restarted, you can even upload new version and the sessions will be kept.


Yes, When you specify an idle timeout in AppPool settings, it basically kills your worker process which in turn destroys your session.

You'll see the value under Cookie Settings tab as one of the ways to handle InProc session is via Cookies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜