如何在asp.net中获取在线用户的数量 [英] How to get count of Online users in asp.net

查看:101
本文介绍了如何在asp.net中获取在线用户的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

我是asp.net的新手,请告诉我如何计算ASP.NET中的在线用户数量?

怎么找到一个用户在线还是离线?



谢谢。

Hi !
I'm new in asp.net , please tell me how to get count of Online users in ASP.NET ?
How to find that an user is Online or Offline ?
.
Thanks .

推荐答案

如果用户离线她/他不适用于您的Web应用程序,因此这部分问题根本没有意义。



至于计算用户,这很容易。请参见 http://forums.asp.net/t/1261165.aspx [ ^ ]。



< dd> -SA
If the user is off-line she/he does not exist for your Web application, so this part of question simply makes no sense.

As to counting the users, it's pretty easy. See http://forums.asp.net/t/1261165.aspx[^].

—SA


对于用户计数,分别在session_start / session_end上有一个应用程序级属性和递增/递减。



如果您需要检查特定用户是否在线/离线,您需要维护每个用户的列表。



结合两个要求,将此列表作为Application属性,并分别在会话开始/结束事件时添加/删除userId。在任何时候,列表的计数将给出在线用户的计数。
For counting users, have an Application level property and increment/decrement upon session_start/session_end respectively.

If you need to check if a particular user is online/offline, you need to maintain a List of each user.

Combining both requirements, have this list as Application property and add/remove the userId upon session start/end events respectively. At any point of time, the count of the list will give the count of the Online users.


这篇关于如何在asp.net中获取在线用户的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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