我怎样才能得到我的网站上的所有登录用户? [英] How can I get all logged-in users on my website?

查看:138
本文介绍了我怎样才能得到我的网站上的所有登录用户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要的所有活跃用户登录我的网站。我知道我可以把我的登录的用户:

I need all active users logged on my website. I know I can take my logged-in user:

var currentUser = manager.FindById(User.Identity.GetUserId());

但我怎么能走呢?

but how can I take all?

推荐答案

ASP.NET成员有一个特点,对于FormsAuthentication 工作。否则,你需要写一个持久性存储的地方最近的活动日期和放大器;然后查询该表在一定范围内活动的所有用户。一个Web应用程序是无状态的,所以主动登录中是一个虚构的抽象我们想象在一个无状态的协议。后一个要求是在服务器已经忘记你。 另一个黑客可能是算多少会话仍然活着,如果你使用的是SQL会话存储

ASP.NET membership has a feature that works for FormsAuthentication. Otherwise you need to write to a persistent store somewhere the most recent activity date & then query that table for all users active within a certain window. A web app is stateless, so "actively logged" in is a fictional abstraction we imagine over a stateless protocol. After a request is over the server has forgotten about you. Another hack might be to count how many sessions are still alive if you are using sql session store.

这篇关于我怎样才能得到我的网站上的所有登录用户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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