超时和会话超时问题
我遇到超时问题。
首先,即使 webconfig 中的时间设置为 120 分钟,服务器上每 20 分钟就会发生一次超时。
其次,当超时发生时,它会转到登录页面,这是正确的,但重新登录时有时会转到默认页面,有时会转到之前所在的页面。我希望它每次都进入默认页面。如果这是问题的话,它应该删除所有会话和 cookie。
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="~/Default.aspx" name="GUI" slidingExpiration="true" timeout="120" path="/">
</forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<sessionState mode="InProc" cookieless="false" timeout="120"/>
这就是我的 webconfig 中的内容。
I have a problem with timeout.
firstly the timeout happens every 20 minutes on server even if the time in webconfig is set to 120 mins.
second, when the timeout happens it goes to the login page, which is correct but on logging back in it sometimes goes to the default page and sometimes to the page it was previously on. I want it to go to the default page everytime. Like it should remove all the sessions and cookies if thats the problem.
<authentication mode="Forms">
<forms loginUrl="Login.aspx" defaultUrl="~/Default.aspx" name="GUI" slidingExpiration="true" timeout="120" path="/">
</forms>
</authentication>
<authorization>
<deny users="?"/>
<allow users="*"/>
</authorization>
<sessionState mode="InProc" cookieless="false" timeout="120"/>
This is what is there in my webconfig.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这可能与您的具体问题相关,也可能无关,但进程内用户会话将无法在应用程序回收后继续存在。在 IIS 中检查您的应用程序回收时间是否足够长。如果应用程序保持活动状态,您的会话确实可能会持续 120 分钟,但一旦闲置时间过长,您的应用程序就会回收,并且您的用户会话将变得无效。
This may or may not be related to your specific issue, but in-proc user sessions will not survive application recycles. Check in IIS that your application recycle time is sufficiently high. Your sessions may indeed last 120 minutes if the application remains active, but once it idles for too long, your app will recycle and your user sessions will become invalidated.
我的理解是,通过您描述的设置,ASP.NET 不允许未经身份验证的 Web 访问您的站点。
这意味着当您转到 WebForm1.aspx 时,您将被重定向到具有此 url 的登录页面
然后在您的登录页面中您可能会看到类似这样的内容
这将重定向回 ReturnUrl 指定的任何内容。
好吧,如果您不希望这种情况发生,请不要这样做。而是做这样的事情。
My understanding is that with the setup you described ASP.NET doesn't allow unauthenticated web access to your site.
This means that when you go to WebForm1.aspx you get redirected to the login page with this url
Then in your login page you might have something like this
This redirects back to whatever the ReturnUrl specifies.
Well if you don't want that to happen don't do that. Do something like this instead.
你好
看一下iis中的应用程序池,检查高级设置->进程模型->空闲超时(分钟)。将其设置为高于 20 分钟。听起来工作进程正在关闭,因为它处于空闲状态。测试系统经常会发生这种情况,因为它们没有获得足够多的命中来阻止空闲超时的发生。
欢呼 Tigger
Hi
Take a look at the application pool in iis, check the advanced settings->process model->idle timeout (minutes). Set this higher than 20 mins. Sounds like the worker process is shutting down because its idle. Often this happens with test systems because they don't get that many hits to stop the idle timeout from kicking in.
Cheers Tigger
检查以下事项:
Check the following things: