我正在使用ASP.NET Forms身份验证,并且当前在Web.config中设置了超时值。有没有办法从代码中设置此超时?我想为不同的用户提供不同的超时时间。
答案 0 :(得分:4)
查看MSDN
上的FormsAuthenticationTicket
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);