The sessionState timeout doesn't work with the DefaultSessionProvider

白昼怎懂夜的黑 提交于 2020-01-14 10:38:08

问题


I have a web site where I use ASP.NET membership for managing user creation, login, role management. I use Visual Studio 2012. There are a lot of elements created by Visual Studio in web.config. One of the element related to session state is the following.

sessionState mode="InProc" customProvider="DefaultSessionProvider"

name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection"

In this link, it says that Custom provider is used when mode is set to Custom. The first question is that if this is the case why Visual Studio generates the session state's mode attribute as InProc and at the same time sets a custom provider? The second issue is with the session state timeout. When I add a timeout value to session state, it doesn't timeout when the time is up.

sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="30"

Time out started working when I removed CustomProvider attribute. Does anybody have more inside to this situation?


回答1:


I realized that the issue about the time out has nothing to do with CustomProvider attribute. The problem was that forms time out and session state time out were set to different values. Once I set them to the same value, it started working.

But still the fact that Visual Studio creates sessionState element with mode = InProc and customProvider = DefaultSessionProvider is strange since Microsoft web site says that the only time customProvider is used is when mode is set to Custom.



来源:https://stackoverflow.com/questions/15704356/the-sessionstate-timeout-doesnt-work-with-the-defaultsessionprovider

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