I am making an app in C# using MVC 3 and I'm trying to learn about the built-in user stuff that comes for free (in the Membership
class).
I want to make a page on my site that lists every user who is currently logged in. Is there a way to do this easily?
var onlineUsers = Membership.GetAllUsers()
.Cast<MembershipUser>().Where(u => u.IsOnline);
Make sure you "bump" the users to be online.
You can learn more on how to retrieve list of users and bind it to a view in this previously asked question on StackOverflow:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.