yes, see http://www.wintellect.com/resources/faqs/default.aspx?faq_id=1&page=4Q: By default, a persistent forms authentication cookie issued by ASP.NET is valid for 50 years. Is it possible to shorten that? A: Yes. Unfortunately, there is no configuration setting you can tweak to customize the lifetime of a persistent authentication cookie, but you can customize it programmatically. Here's a snippet of code that returns a persistent authentication cookie from a forms login page and limits the cookie's lifetime to 7 days: string url = FormsAuthentication.GetRedirectUrl ("Elmo", true); FormsAuthentication.SetAuthCookie ("Elmo", true); HttpCookie cookie = Response.Cookies[FormsAuthentication.FormsCookieName]; cookie.Expires = DateTime.Now + new TimeSpan (7, 0, 0, 0); Response.Redirect (url);
To set the cookie's lifetime to something other than 7 days, simply modify the TimeSpan value.
http://www.wintellect.com/resources/faqs/default.aspx?faq_id=1&page=4Q: By default, a persistent forms authentication cookie issued by ASP.NET is valid for 50 years. Is it possible to shorten that? A: Yes. Unfortunately, there is no configuration setting you can tweak to customize the lifetime of a persistent authentication cookie, but you can customize it programmatically. Here's a snippet of code that returns a persistent authentication cookie from a forms login page and limits the cookie's lifetime to 7 days: string url = FormsAuthentication.GetRedirectUrl ("Elmo", true);
FormsAuthentication.SetAuthCookie ("Elmo", true);
HttpCookie cookie = Response.Cookies[FormsAuthentication.FormsCookieName];
cookie.Expires = DateTime.Now + new TimeSpan (7, 0, 0, 0);
Response.Redirect (url);
To set the cookie's lifetime to something other than 7 days, simply modify the TimeSpan value.