代码之家  ›  专栏  ›  技术社区  ›  Joel Martinez

表单身份验证cookie过早过期

  •  0
  • Joel Martinez  · 技术社区  · 14 年前

    我能查什么?如何排除故障?我不能在本地复制,也不能在我们的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>
    
    3 回复  |  直到 11 年前
        1
  •  0
  •   Aristos    14 年前

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

    通过www:yourdomain.com将其设置为root name

    <authentication mode="Forms">
      <forms 
      path="/" 
      domain="yourdoman.com"  // <- maybe this key is the reason
      />
    </authentication>
    
        2
  •  1
  •   Community    7 年前

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

    这类似于以下问题:

    figuring out why asp.net authentication ticket is expiring

        3
  •  0
  •   cjk    14 年前

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