2012-07-14 40 views
2

我想在一個網站上做一週「記住時間」。在默認的mvc 3應用程序中,我設置了以下更改:不正確的表單身份驗證超時

<forms loginUrl="~/Account/LogOn" timeout="10880" slidingExpiration="true" /> 

但是,它不夠。半小時後遺忘我。什麼可能是錯的?

回答

2

您是否爲表單身份驗證票據設置了屬性超時值,並且isPersistent參數應設置爲true

FormsAuthenticationTicket tkt = new FormsAuthenticationTicket 
(
    1,     // version 
    username,   // user name 
    DateTime.Now,  // issue date 
    expiration,  // this should also be set to 10880 
    rememberMeChecked, // this should be true 
    null,    // additional data 
    "/"    // cookie path 
); 

欲瞭解更多信息,請參閱here