ASP.NET 2.0会话超时 [英] ASP.NET 2.0 Session Timeout

查看:74
本文介绍了ASP.NET 2.0会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经有人提出了这个论坛关于会话超时这个问题。将AP preciate如果有人能再次澄清这一点。

Already someone has raised this question in this forum regarding session timeout. Would appreciate if someone can clarify this again.

我有一个asp.net 2.0应用程序,超时说,15-20分钟后,如果用户没有做任何活动和presses页面上的按钮(他被重定向到sessionExpired.aspx页)。我已经会话超时设置为60分钟在我的web.config文件,但仍不知何故用户超时。

I have an asp.net 2.0 application which times out after say 15-20 minutes if user didnt do any activity and presses a button on the page(he is redirected to sessionExpired.aspx page). I have set the session timeout to 60 minutes in my web.config file but still somehow the user is timed out.

我有一个关于会话超时precedence与此相关的另一个问题。是否IIS会话超时优先于ASP.NET会话超时。说,如果IIS会话超时设置为20分钟,ASP.NET会话超时为60分钟,并ASP.NET覆盖IIS会话超时。

I have another question related to this regarding the Session Timeout Precedence. Does IIS session timeout take priority over ASP.NET session timeout. Say if IIS session timeout is set to 20 minutes and ASP.NET session timeout is 60 minutes, does ASP.NET override IIS session timeout.

推荐答案

IIS花费precedence,但他们处理略有不同的方案。

IIS takes precedence, but they deal with slightly different scenarios.

在IIS的情况下,缺省为20分钟的时间里,出于对应用程序池是指传入的请求。如果你的应用程序不会接收所有20分钟的任何请求,那么应用程序池处于休眠状态以节省资源。当这种情况发生在你的应用程序的所有会话都没有了。

In the case of IIS, the default 20 minutes time-out for the application pool is referring to incoming requests. If your application doesn't receive any requests at all for 20 minutes then the application pool is put to sleep to save resources. When this happens all the sessions in your application are gone.

与每个会话的请求的ASP.NET会话超时交易。您的网站可能是相当忙碌的,但如果一个用户(即会话)不是20分钟仅该会话被丢弃活跃。

The ASP.NET session time-out deals with per-session requests. Your site could be quite busy, but if one user (i.e. session) is not active for 20 minutes only that session is discarded.

所以,是的,以确保会话保持存活60分钟,你必须更改IIS应用程序池超时设置以及web.config文件。

So yes, to make sure the session stays alive for 60 minutes you have to change the time-out settings for the IIS application pool as well as web.config.

处理这个问题的另一种方法是周期性地发送一个小的AJAX平(即具有随机ID到prevent浏览器缓存寻呼请求)回服务器。这样,只要用户不关闭浏览器,该会议将是preserved。

Another way of approaching this problem is to periodically send a small AJAX "ping" (i.e. a page request with a random ID to prevent browser caching) back to the server. This way, as long as the user doesn't close the browser, the session will be preserved.

这篇关于ASP.NET 2.0会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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