2009-09-28 69 views
0

我正在使用ASP.NET窗體身份驗證,並且當前在Web.config中設置超時值。有沒有辦法從代碼中設置這個超時?我想爲不同的用戶提供不同的超時時間。動態表單身份驗證超時?

回答

3

時退房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);