SimpleMembershipProvider.GetAllUsers Method

Returns all of the user accounts in the data source.

Namespace:  WebMatrix.WebData
Assembly:  WebMatrix.WebData (in WebMatrix.WebData.dll)

public override MembershipUserCollection GetAllUsers(
	int pageIndex,
	int pageSize,
	out int totalRecords


Type: System.Int32
The zero-based index of the page of results to return.
Type: System.Int32
The size of the page of results to return.
Type: System.Int32%
When this method returns, contains the total number of matched user accounts.

Return Value

Type: System.Web.Security.MembershipUserCollection
A collection that contains a page of pageSize user accounts starting at the page specified by pageIndex.

User accounts are returned in alphabetical order by user name.

This method returns results that are in logical pages. This lets you return user information in manageable chunks. For example, if your application currently has 2000 user accounts, you can return 200 pages of 10 users at a time.

The specific page to return is defined by the pageIndex and pageSize parameters. The totalRecords parameter is an out parameter that is set to the total number of user accounts in the database. For example, if there are 13 users in the database, and the pageIndex value is 1 and pageSize is 5, the MembershipUserCollection object contains the sixth through the tenth user accounts and totalRecords is set to 13.


If the SimpleMembershipProvider class has been initialized using a call to the WebSecurity.InitializeDatabaseConnection() method, this method is not supported and will throw a NotSupportedException exception. However, if the WebSecurity.InitializeDatabaseConnection() method has not been called, and if you have configured your site to use the standard ASP.NET membership provider, this method is passed through to the standard membership provider. For more information, see the SimpleMembershipProvider class overview.

  • Medium trust for the immediate caller. This member can be used by partially trusted code.