Sitecore 7.5 MVC and HttpContext.Session.Timeout set to 1 minute

I have a 20min session timeout set , but when I try to access this value from an action, I get 1min .

Web.Config Settings:

<sessionState mode="InProc" cookieless="false" timeout="20"> <authentication mode="None"> <forms name=".ASPXAUTH" cookieless="UseCookies" timeout="20" /> </authentication> 

In Global.asax.cs in Session_Start, the timeout value is 20 minutes :

 HttpContext.Current.Session.Timeout 

But in action, my controller is set to 1min :

 System.Web.HttpContext.Current.Session.Timeout HttpContext.Session.Timeout 

I found that when I delete SitecoreHttpModule , which is of type ( Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus ) from web.config, the timeout works fine, but I don't think I can delete it forever.

  <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> 

Is there a place where I can set this timeout for this module, or is there another way to set the session timeout to the desired value?

+5
source share
3 answers

Each first request for a new user is considered as a possible bot request. That is why the session timeout is set to 1 minute for those requests.

If the request is made by the proper end user, your page should have a VisitorIdentification code that will actually make another background call to the server and extend the session for the user.

Just add

 @using Sitecore.Mvc.Analytics.Extensions ... @Html.Sitecore().VisitorIdentification() 

into your .cshtml file.

The wait time will be set to 1 minute for the first request, but then will automatically change to 20 (or whatever it is configured) when Sitecore makes a call to VisitorIdentification .

+5
source

The problem is finding robots in the Sitecore Analytics module. My browser is recognized as a bot, and there are some settings in the Sitecore.Analytics.Tracking.config file:

  <!-- ANALYTICS ROBOTS SESSION TIMEOUT The ASP.NET Session Timeout for auto detected robots. When the automatic robot detection identifies a session as being a robot, the ASP.NET Session Timeout is set to this value (in minutes). Default: 1 --> <setting name="Analytics.Robots.SessionTimeout" value="1" /> 

The timeout is set to 1min when a bot is detected in order to save some memory, and not hold the session for too long.

The timeout will be set to the desired value of 20min when I either turn off analytics altogether or turn off Analytics.AutoDetectBots (in the Sitecore.Analytics.Tracking.config file).

The correct solution for this is to properly configure the browser (and not as a bot).

Another post on this issue:

Sitecore Analytics SessionTimeout Robots Causing Premature Session Timeout

+3
source

Sitecore 7 now has several places where you must specify a session timeout.

I would check these values ​​in your Web.config.

 <setting name="Authentication.ClientSessionTimeout" value="120" /> 

and

 <forms name=".ASPXAUTH" cookieless="UseCookies" timeout="120" /> 

and then

 <sessionState mode="InProc" ... timeout="120" /> 

More details here:

Strange timeout in Sitecore 7

+1
source

Source: https://habr.com/ru/post/1213794/


All Articles