我将会话超时设置为20分钟但是当我尝试从操作中访问此值时,我得到了1分钟.
Web.Config设置是:
<sessionState mode="InProc" cookieless="false" timeout="20"> <authentication mode="None"> <forms name=".ASPXAUTH" cookieless="UseCookies" timeout="20" /> </authentication>
在Global.asax.cs中,Session_Start的超时值为20min:
HttpContext.Current.Session.Timeout
但在我的控制器中的操作设置为1分钟:
System.Web.HttpContext.Current.Session.Timeout HttpContext.Session.Timeout
我发现当我从web.config中删除类型为(Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus)的SitecoreHttpModule时,超时工作正常,但我不认为我可以永久删除它.
<system.webServer> <modules runAllManagedModulesForAllRequests="true"> <remove name="WebDAVModule"/> <add type="Sitecore.Web.RewriteModule,Sitecore.Kernel" name="SitecoreRewriteModule"/> <!-- !!!REMOVED MODULE!!! <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule"/> --> <add type="Sitecore.Resources.Media.UploadWatcher,Sitecore.Kernel" name="SitecoreUploadWatcher"/> <add type="Sitecore.IO.XslWatcher,Sitecore.Kernel" name="SitecoreXslWatcher"/> <add type="Sitecore.IO.LayoutWatcher,Sitecore.Kernel" name="SitecoreLayoutWatcher"/> <add type="Sitecore.Configuration.ConfigWatcher,Sitecore.Kernel" name="SitecoreConfigWatcher"/> ... </modules> </system.webServer>
有没有我可以为此模块配置此超时的地方,还是有其他方法可以将会话超时设置为所需的值?
解决方法
对新用户的每个第一次请求都被视为可能的机器人请求.这就是为什么这些请求的会话超时设置为1分钟.
如果请求由适当的最终用户执行,则页面上应该有VisitorIdentification代码,这实际上将导致对服务器的另一个后台调用并为用户扩展会话.
只需添加
@using Sitecore.Mvc.Analytics.Extensions ... @Html.Sitecore().VisitorIdentification()
到您的布局.cshtml文件.
对于第一个请求,超时将设置为1分钟,但是当Sitecore执行VisitorIdentification调用时,会自动更改回20(或配置的任何内容).
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。