Sitecore 7.5 MVC和HttpContext.Session.Timeout设置为1分钟

Pio*_*r W 5 asp.net-mvc session sitecore sitecore7 sitecore7.5

我将会话超时设置为20分钟但是当我尝试从操作中访问此值时,我得到了1分钟.

Web.Config设置是:

<sessionState mode="InProc" cookieless="false" timeout="20">

<authentication mode="None">
  <forms name=".ASPXAUTH" cookieless="UseCookies" timeout="20" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

在Global.asax.cs中,Session_Start的超时值为20min:

HttpContext.Current.Session.Timeout
Run Code Online (Sandbox Code Playgroud)

但在我的控制器中的操作设置为1分钟:

System.Web.HttpContext.Current.Session.Timeout 
HttpContext.Session.Timeout
Run Code Online (Sandbox Code Playgroud)

我发现当我从web.config中删除SitecoreHttpModuletype(Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus)时,超时工作正常,但我不认为我可以永久删除它.

 <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>
Run Code Online (Sandbox Code Playgroud)

有没有我可以为此模块配置此超时的地方,还是有其他方法可以将会话超时设置为所需的值?

Mar*_*lak 6

对新用户的每个第一次请求都被视为可能的机器人请求.这就是为什么这些请求的会话超时设置为1分钟.

如果请求由正确的最终用户执行,则VisitorIdentification页面上应该有代码,这实际上会导致对服务器的另一个后台调用并为用户扩展会话.

只需添加

@using Sitecore.Mvc.Analytics.Extensions
...
@Html.Sitecore().VisitorIdentification()
Run Code Online (Sandbox Code Playgroud)

到您的布局.cshtml文件.

对于第一个请求,超时将设置为1分钟,但是当Sitecore执行VisitorIdentification呼叫时,会自动更改回20(或配置的任何内容).