可以在窗口关闭Session_End中火? (ASP.NET) [英] Can Session_End fire on window close? (ASP.NET)

查看:161
本文介绍了可以在窗口关闭Session_End中火? (ASP.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我把一个在线计数器在网站上,我遇到了这两个矛盾的来源。

I am putting an "online" counter on a website, and I have run into these two contradicting sources.

这一次(我用这个例子code):

This one (I am using this example code):

<一个href=\"http://aspdotnetfaq.com/Faq/How-to-show-number-of-online-users-visitors-for-ASP-NET-website.aspx\" rel=\"nofollow\">http://aspdotnetfaq.com/Faq/How-to-show-number-of-online-users-visitors-for-ASP-NET-website.aspx

...说:

另外
  我们的网站,会话将到期,而我们的OnlineUsers全局变量
  被降低。

Also when user closes his browser or does not click on any links in our website, session expires, and our "OnlineUsers" global variable is decreased.

然而,这样一句:

http://www.velocityreviews.com/forums/t383710-会话结束guarantee.html

...说:

关闭浏览器窗口,或者浏览到其他网站会不会造成
  Session_End中开火,至少不是通俗易懂 - 服务器有
  绝对没有办法知道在客户机上发生了什么,直到
  它得到另一个Htt的prequest如此。在这种情况下,Session_End中
  将火的时候,会话超时,自然。

Closing the browser window, or browsing to another site will NOT cause Session_End to fire, at least, not straightaway - the server has absolutely no way of knowing what happens on the client machine until it gets another HttpRequest from it. In this instance, Session_End will fire when the session times out naturally.

我已经测试过,似乎Session_End中不火。

I have tested and it seems that Session_End DOES NOT fire.

我基本上希望你们确认或对此有何评论。

I basically want you guys to confirm or comment on this.

是否有可能更新浏览器关闭?在线计数器

推荐答案

二是真正

关闭浏览器窗口,或者浏览到其他网站会不会造成
  Session_End中开火,至少不是通俗易懂 - 服务器有
  绝对没有办法知道在客户机上发生了什么,直到
  它得到另一个Htt的prequest如此。在这种情况下,Session_End中
  将火的时候,会话超时,自然。

Closing the browser window, or browsing to another site will NOT cause Session_End to fire, at least, not straightaway - the server has absolutely no way of knowing what happens on the client machine until it gets another HttpRequest from it. In this instance, Session_End will fire when the session times out naturally.

会话超时20分钟默认情况下。你可以不这样做在您的网站的任何活动20分钟证实了这一点。

Session time out is 20 minutes by default. You can confirm this by not doing any activity on your website for 20 min.

这篇关于可以在窗口关闭Session_End中火? (ASP.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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