弄清楚为什么asp.net验证票到期 [英] figuring out why asp.net authentication ticket is expiring

查看:121
本文介绍了弄清楚为什么asp.net验证票到期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要帮助搞清楚为什么我的身份验证票证约一小时后,截止于我的托管网站。但是,如果我在本地运行的网站上的身份验证票证保持活着的时间正确的金额。

I need help figuring out why my authentication ticket is expiring after about an hour on my hosted website. But if I run the site locally the authentication ticket stays alive for the correct amount of time.

这是我的本地web.config中:

This is my localhost web.config:

<authentication mode="Forms">
    <forms loginUrl="~/Account/LogOn" timeout="20160" slidingExpiration="true" path="/" />
</authentication>

这是我的托管的web.config:

and this is my hosted web.config:

<authentication mode="Forms">
	<forms loginUrl="~/Account/LogOn" timeout="20160" slidingExpiration="true" domain=".mywebsite.com" path="/" />
</authentication>

我知道正在创建的认证券,原因是:

I know the authentication ticket is being created because:


  • 我可以看到它在浏览器中的cookies

  • 我保持登录状态,即使关闭浏览器,然后重新打开后

  • 我保持登录状态后,即使网站再循环(更改和保存的web.config回收吧)

当我检查Cookie到期日在它的2周后的浏览器。然而,大约一个小时后,我的身份验证始终过期。

When I check the cookie expiration date in the browser it's 2 weeks later. However, after about an hour my authentication always expires.

我能做些什么来弄清楚为什么托管网站的身份验证是这么早就过期?
我不知道如何去,因为这是我的托管网站,是有问题的唯一解决这个问题。

What can I do to figure out why the hosted website's authentication is expiring so early? I don't know how to go about resolving this problem since it's my hosted website that is the only one having problems.

更新1:等待1小时后,检查我的浏览器,我看到的cookie仍然存在。事实上,它的截止日期为2周后。但是,如果我重新载入页面或尝试将我带到了登录页面,要求身份验证的任何页面。

Update 1: After waiting 1 hour, I check my browser and I see the cookie still exists. In fact it's expiration date is set for 2 weeks later. But if I reload the page or try going to any pages that requires authentication I am taken to the login page.

推荐答案

我添加了一个system.net的machineKey条目。事情是这样的:

I added a machinekey entry in system.net. Something like this:

	<machineKey validationKey="aaa"
	decryptionKey="bbb" validation="SHA1" />

和现在它让登录的用户。但是,现在好像我有性能问题。所使用的页面,需要大约500ms的加载,现在大约需要两倍的时间。

and now it keeps the user logged in. However, now it seems like I am having performance issues. The page used to take roughly 500ms to load now takes about double that time.

这篇关于弄清楚为什么asp.net验证票到期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆