【问题标题】:Forms Auth premature cookie expirationForms Auth cookie 过早过期
【发布时间】:2010-07-08 15:48:23
【问题描述】:

我在处理一个刚刚投入生产的网站时遇到了问题。出于某种原因,虽然 15 分钟会话超时的设置似乎是正确的,但用户报告说他们必须在大约 5 分钟后重新登录。

我可以检查什么?我该如何解决这个问题?我无法在本地或在我们的 QA 环境中复制它。我可以检查 IIS 设置吗?客户端的浏览器设置?

下面是我用于身份验证的 web.config 条目。谢谢!

    <authentication mode="Forms">
        <forms loginUrl="~/admin/Login" cookieless="UseCookies" requireSSL="false" timeout="15" slidingExpiration="true" name="{C8226EAB-2423-45ce-8A1D-3BC227F1BEE9}"/>
    </authentication>

【问题讨论】:

    标签: asp.net authentication cookies forms-authentication


    【解决方案1】:

    您需要将机器密钥添加到您的 web.config 文件中。它会随着每个应用程序池回收而自动生成,并导致您的身份验证票 cookie 值失败。

    这类似于下面的问题:

    figuring out why asp.net authentication ticket is expiring

    【讨论】:

      【解决方案2】:

      嗯,我认为您还需要设置域名的设置。不要设置 www.yourdomain.com,因为这样如果用户访问 yourdomain.com 会得到不同的 cookie。

      使用我们的 www:yourdomain.com 将其设置为根名称

      <authentication mode="Forms">
        <forms 
        path="/" 
        domain="yourdoman.com"  // <- maybe this key is the reason
        />
      </authentication>
      

      【讨论】:

        【解决方案3】:

        在 IIS 管理器中也将会话设置为至少 15 分钟。

        【讨论】:

          猜你喜欢
          • 2013-12-26
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-10-14
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-01-24
          相关资源
          最近更新 更多