SimpleMembershipProvider.FindUsersByName Method

Returns all of the user accounts whose name matches the specified user name.

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

Public Overrides Function FindUsersByName ( _
	usernameToMatch As String, _
	pageIndex As Integer, _
	pageSize As Integer, _
	<OutAttribute> ByRef totalRecords As Integer _
) As MembershipUserCollection
Dim instance As SimpleMembershipProvider 
Dim usernameToMatch As String 
Dim pageIndex As Integer 
Dim pageSize As Integer 
Dim totalRecords As Integer 
Dim returnValue As MembershipUserCollection 

returnValue = instance.FindUsersByName(usernameToMatch, _
	pageIndex, pageSize, totalRecords)


Type: System.String
The user name to search for.
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 users.

Return Value

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

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 that matched the usernameToMatch value. For example, if 13 users are found, 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.