In ASP.NET MVC 3 with built-in user login using forms, how can I get a list of registered users?

I am building a C # application using MVC 3, and I am trying to learn about the built-in custom material that comes free (in the Membership class).

I want to make a page on my site that lists all the users who are currently logged in. Is there any way to make this easy?

+4
source share
2 answers
 var onlineUsers = Membership.GetAllUsers() .Cast<MembershipUser>().Where(u => u.IsOnline); 

Make sure you bounce users online.

+8
source

You can learn more about how to get a list of users and bind it to a view in this previously asked question in StackOverflow:

List of users and roles using the membership provider

-1
source

All Articles