开发者

How to get All users in web application by setting role as search parameter - asp.net mvc

开发者 https://www.devze.com 2023-04-07 20:48 出处:网络
In my MVC application开发者_运维技巧 I am usingmembership service . I need apage to list the users. But there are 1000\'s of users are in my application. So i don\'t need to display all of them in one

In my MVC application开发者_运维技巧 I am using membership service . I need a page to list the users. But there are 1000's of users are in my application. So i don't need to display all of them in one page.

I am planning to give a search option .I mean admin user can search by specifying user role and how many users can show in one page.How can i do this ? Any ideas?

current code

Model

public MembershipUserCollection Users { get; set; }

Controller

 model.Users = Membership.GetAllUsers();

But i am getting all users in the application.


You probably want to query your role provider:

public ActionResult Foo()
{
    string[] usernamesInRole = Roles.GetUsersInRole("some_role");
    ...
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号