Sitecore 8 - Session times out at 1 minute

2019-09-04 09:53发布

I am trying to implement a customer login system on my website built on Sitecore 8. When a customer correctly enters their username and password (checked against an external database), I set

Session["User ID"] = USER_ID;

and redirect to the home page. This all works fine except the Session["User ID"] variable clears after 1 minute, resulting in the user being logged out. I've tried extending the sessionState timeout parameter in web.config to 60 but that did not work. Any ideas on why this is happening?

2条回答
放荡不羁爱自由
2楼-- · 2019-09-04 10:17

You can set a Timeout for a session using this:

  Session["User ID"] = "XX";
  Session.Timeout = 600000;

This would limit your session to 10 minutes for example.

Goodluck.

查看更多
The star\"
3楼-- · 2019-09-04 10:25

Yes. Likely your page doesn't include proper DMS VisitorIdentification, resulting your session in being flagged as a robot. Robots get a short session expiration to save server resources.

Described here: http://zzzgo.com/2015/03/24/Sitecore-session-timeout-quickly-1-min-when-not-logged-in.html

And here: Sitecore 7.5 MVC and HttpContext.Session.Timeout set to 1 min

查看更多
登录 后发表回答