动态表单身份验证超时?

时间:2009-09-28 23:08:36

标签: asp.net forms-authentication

我正在使用ASP.NET Forms身份验证,并且当前在Web.config中设置了超时值。有没有办法从代码中设置此超时?我想为不同的用户提供不同的超时时间。

1 个答案:

答案 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);