I’m creating a user approval interface leveraging the .Net Membership class. I have a page that does a Membership.GetAllUsers(), and I spit the results to a datagrid. I filter them by MembershipUser.IsApproved.
My Issue is due to slowness I’m hitting while I GetAllUsers().
Since I don’t need to pull down all of the users, but rather, say, all of the users with a CreateDate falling within a certain range, I’m wondering if there’s a way to grab a subset based on date-range?
Wanted to Update for those in a similar situation:
UPDATE:
So, I ended up actually not using the answer below.. Although, it does address the specific question properly. Anyhow, my real problem was, grabbing a subset of Users (i.e. those requiring “approval” – Since my Admin holds control of this (not the users)). My solution was to assign newly signedup users to an “awaitingapproval” role, then I was able to grab Roles.UsersInRole(“awaitingapproval”), display those to the Admin with the ability to “approve” a user. Each approved user is then dropped from “awaitingapproval” and assigned to a new role.
Although there are overloads for GetAllUsers() to return a subset of users based on index (i.e. one “page” of users at a time), there is nothing that you could use to base it on custom logic like this.
I would probably write a new class that inherits the base membership provider and add a new overload for GetAllUsers().
You can use Reflector to see the source code for System.Web.Security.SqlMembershipProvider’s implementation of GetAllUsers() as a starting point.