在使用Forms的内置用户登录的ASP.NET MVC 3中,如何检索当前登录用户的列表?

Rob*_*tin 4 c# asp.net-mvc-3

我正在使用MVC 3在C#中创建一个应用程序,我正在尝试了解免费(在Membership课堂上)内置的用户内容.

我想在我的网站上创建一个页面,其中列出了当前登录的每个用户.有没有办法轻松完成此操作?

Dan*_*ite 8

var onlineUsers = Membership.GetAllUsers()
    .Cast<MembershipUser>().Where(u => u.IsOnline);
Run Code Online (Sandbox Code Playgroud)

确保您"阻止"用户在线.