【问题标题】:Incorrect forms authentication timeout不正确的表单身份验证超时
【发布时间】:2012-07-14 14:03:59
【问题描述】:

我想在一个网站上制作“记住时间”大约一周。在默认的 mvc 3 应用程序中,我设置了以下更改:

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

但是,这还不够。半小时后网站忘了我。有什么问题?

【问题讨论】:

    标签: asp.net-mvc-3 authentication forms-authentication


    【解决方案1】:

    您是否为表单身份验证票设置了属性超时,并且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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 1970-01-01
      • 2010-12-01
      • 1970-01-01
      • 2013-10-22
      • 1970-01-01
      相关资源
      最近更新 更多