动态表单身份验证超时?

问题描述:

我正在使用ASP.NET窗体身份验证,并且当前在Web.config中设置超时值。有没有办法从代码中设置这个超时?我想为不同的用户提供不同的超时时间。动态表单身份验证超时?

时退房FormsAuthenticationTicketMSDN

FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, 
     "userName", 
     DateTime.Now, 
     your_time_out_goes_here, // value of time out property 
     false, // Value of IsPersistent property 
     String.Empty, 
     FormsAuthentication.FormsCookiePath);