See this issue on the Microsoft Connect website . It was closed as "Do not fix", but it looks like it was fixed in .NET 4.
One way to do this in .NET 2.0 or 3.x is to issue and validate a FormsAuthentication ticket:
FormsAuthentication.SetAuthCookie("user", false); HttpCookie cookie = (HttpCookie)(Request.Cookies[FormsAuthentication.FormsCookieName]); FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value); int timeoutInMinutes = (ticket.Expiration - ticket.IssueDate).TotalMinutes;
Another is to use the configuration API:
Configuration config = Configuration.OpenWebConfiguration(HttpRuntime.AppDomainAppPath); AuthenticationSection section = (AuthenticationSection)config.GetSection("system.web/authentication"); int timeout = section.Forms.Timeout.TotalMinutes;
Joe Mar 07 '12 at 11:25 2012-03-07 11:25
source share