ASP.NET:用户不会保持登录超过30分钟

Jas*_*son 5 asp.net forms-authentication login

这真的让我很恼火,可能会导致我网站上的用户减少.我正在使用表单身份验证来记录我的用户.

我在用户登录时默认将"Persist"参数设置为true:

RedirectFromLoginPage(userString, True)
Run Code Online (Sandbox Code Playgroud)

SetAuthCookie(userString, True)
Run Code Online (Sandbox Code Playgroud)

在我的web.Config文件中,我将"timeout"属性设置为"129600":

<authentication mode="Forms">
    <forms loginUrl="/registration/login.aspx"
    timeout="129600" slidingExpiration="true" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

我打电话给我的托管公司,他们说问题必须与我的代码有关.我不相信这种情况.

什么#(@%&@(#%&@(#*%可能是错的?

编辑这曾经很好地工作,直到我切换主机.这让我相信这不是我的代码,而实际上是主持人.

编辑2在回复使用Fiddler的评论时,这是我在加载页面时从Fiddler获得的内容:

Set-Cookie: .ASPXAUTH=; expires=Tue, 12-Oct-1999 07:00:00 GMT; path=/; HttpOnly
Set-Cookie: .ASPXAUTH=[some gobbledygook]; 
  expires=Sun, 15-Nov-2009 20:46:29 GMT; path=/; HttpOnly
Set-Cookie: ASP.NET_SessionId=vudqghfplqnh5hz1qw1cwebt; path=/; HttpOnly

Eri*_* J. 2

有很多因素可能会导致超时。 该博客提供了很好的概述。