ASP .NET MVC 3. Session expired too quickly

…衆ロ難τιáo~ 提交于 2019-12-04 13:32:50

Are all your users losing session state at the same time? If so, your app pool could be recycling. There are several reasons why this can happen.

I would recommend you consider setting up your user session management so that it is able to survive application and session restarts. Here are some options.

Had the same problem, added the below two appSettings:

 <add key="enableSimpleMembership" value="false" />
 <add key="autoFormsAuthentication" value="false" />

My Forms:

<forms name="ASPXFORMSAUTH" path="/" domain="something.com" loginUrl="~/Account/LogOn" cookieless="UseCookies" slidingExpiration="true" timeout="1441" requireSSL="false" />

works well now!

A lot of the stated goals of MVC were to move to a stateless model - how much application change can you make to move to a stateless model? If you were to add some identifying information to your ajax calls and make them stateless, using session state wouldn't be a dependency (over simplified, of course - I have no idea what your app is doing).

How are you creating your form tag?

Are you using IIS 7? In case take a look at:

Application pool’s Idle Time-out(minutes)

Session state – State server’s Time-out (seconds)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!