Determining an #39;active#39; user count of an ASP.NET site(确定 ASP.NET 站点的“活动用户数)
问题描述
在 ASP.NET 站点上,有哪些技术可用于跟踪在任何给定时间点登录该站点的用户数量?
On an ASP.NET site, what are some techniques that could be used to track how many users are logged in to the site at any given point in time?
例如,我可以生成一个报告,显示如下内容:
So for example, I could produce a report showing something like this:
10:00am 11:00am 12:00pm 1:00pm 2:00pm ....
3/25 25 32 45 40 37
3/26 31 38 50 57 40
3/27 28 37 46 35 20
etc.
不,我们没有使用 ASP.NET 成员资格提供程序,它使用基于本地/hacky 会话的方法来确定用户是否处于登录"状态.
No, we're not using ASP.NET Membership provider, it uses a home-grown/hacky session based method of determining whether or not a user is in 'logged in' status.
推荐答案
网站是否让用户登录?如果是这样,那么您可以在每次请求新页面时更新用户表中的上次访问"字段,然后每小时执行一次 SQL 查询,获取上次访问中具有上次访问"时间戳的每个人15 分钟左右(假设当前在网站上).
Does the website log the user in? If it does, then you can update a "Last Visit" field in the user table every time they request a new page, and then every hour, just do a SQL query that grabs everybody who has a "Last Visit" timestamp within the last 15 minutes or so (assumed to currently be on the site).
如果您没有人登录,您可以通过 IP 地址而不是用户名轻松登录.但是,使用这种方法,您可能会遇到一些代理问题(即来自同一公司网络的多个用户可能都来自同一个 IP 地址,因此他们在您的总数中只算作一个用户),但这应该是最小的.
If you're not having people log in, you could just as easily do it by IP address instead of username. With this method, though, you may run into some proxy issues (ie multiple users from the same corporate network may all come from a single IP address, so they only count as one user in your totals), but that should be minimal.
这篇关于确定 ASP.NET 站点的“活动"用户数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:确定 ASP.NET 站点的“活动"用户数
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- MS Visual Studio .NET 的替代品 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 如何激活MC67中的红灯 2022-01-01