Search code examples
c#asp.net-mvcasp.net-mvc-3membership-provider

How can I use GetAllUsers in the ASP Membership provider?


I am trying to make a list of all the users of my system and using the following:

    public MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
    {
        return _provider.GetAllUsers(pageIndex, pageSize, out totalRecords);
    }

But I don't understand how to use these parameters. I have looked around on the web and can't find any examples.

Does anyone have an example of where they have C# code to query and list users?


Solution

  • This method supports paging. If your userbase is small or you don't care about paging, you could simply use another overload that doesn't expect any parameters.

    public static MembershipUserCollection GetAllUsers()