user548929
user548929

Reputation: 25

asp.net forms authentication timing out after 1 minute

I'm using ASP.NET MVC 3 with the Authorize attribute, but it keeps kicking me to the logon page after 1 minute, but even though my expiration is set to a very high value, it times out quickly. I check the cookie in my browser and its still there and not set to expire until about a month later, and it's set to be persistent, so I'm not sure why it keeps booting me. It only happens on my published location, locally it works just fine.

var ticket = new FormsAuthenticationTicket(username, true, 500000);
var encryptedTicket = FormsAuthentication.Encrypt(ticket);
var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
cookie.Expires = ticket.Expiration;

Response.Cookies.Add(cookie);

web.config:

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="7200" slidingExpiration="false"/>
</authentication>

Upvotes: 1

Views: 1042

Answers (1)

Jahan Zinedine
Jahan Zinedine

Reputation: 14864

Chances are the worker process is recycled meantime, Where do you store the sessions?

Making your sessions stored out of process may helps.

Upvotes: 1

Related Questions