Thursday, 19 September 2013

FormsAuthenticationTicket and SlidingExpiration

FormsAuthenticationTicket and SlidingExpiration

I have this snippet of code in to authenticate create a Forms
AuthenticationTicket:
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
username, DateTime.Now, DateTime.Now.AddMinutes(60), isCookiePersistent,
groups);
I think this is pretty boilerplate code. However, when I go to set my
slidingExpiration attribute in my web.config file as so:
<forms loginUrl="domain.com/auth/login.aspx" slidingExpiration="true"
defaultUrl="https://domain.com" cookieless="UseDeviceProfile"
domain="domain.com">
</forms>
It appears that my slidingExpiration is not working. I have tried
requesting a page within the time that it specifies (from what I
understand in between minute 30 and minute 60), but it still logs me out.
Why is this happening?
Thanks!

No comments:

Post a Comment