我将会话超时设置为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中删除SitecoreHttpModule
type(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)
有没有我可以为此模块配置此超时的地方,还是有其他方法可以将会话超时设置为所需的值?
我正在处理Sitecore应用程序,它将一些"项目"存储到购物车中,供未经过身份验证的用户(我猜他们不应该这样)使用如下代码:
this.Session["abc"]
Run Code Online (Sandbox Code Playgroud)
然后,一旦用户到达购物车页面并希望继续进行,而不是等待时间超过一分钟而不是会话中的价值丢失!
这是我的web.config
相关设置:
我在这里的绳索结束,不知道什么是清洁我的会话?
<sessionState mode="InProc" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.FXM.SessionManagement.ConditionalSessionIdManager">
<providers>
<add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" sessionType="Standard" connectionStringName="session" pollingInterval="2" compression="true" />
<add name="mssql" type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider, Sitecore.SessionProvider.Sql" sessionType="Standard" connectionStringName="session" pollingInterval="2" compression="true" />
</providers>
</sessionState>
Run Code Online (Sandbox Code Playgroud)
和
<authentication mode="None">
<forms name=".ASPXAUTH" cookieless="UseCookies" timeout="90" />
</authentication>
Run Code Online (Sandbox Code Playgroud)
我想你不需要通过身份验证来使用会话?是的,我确实检查了代码,确保没有任何东西使我的会话无效.