2012-07-14 83 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