Export (0) Print
Expand All

MembershipProvider.FindUsersByName Method

Gets a collection of membership users where the user name contains the specified user name to match.

Namespace: System.Web.Security
Assembly: System.Web (in system.web.dll)

public abstract MembershipUserCollection FindUsersByName (
	string usernameToMatch,
	int pageIndex,
	int pageSize,
	out int totalRecords
)
public abstract MembershipUserCollection FindUsersByName (
	String usernameToMatch, 
	int pageIndex, 
	int pageSize, 
	/** @attribute OutAttribute() */ /** @ref */ int totalRecords
)
Not applicable.

Parameters

usernameToMatch

The user name to search for.

pageIndex

The index of the page of results to return. pageIndex is zero-based.

pageSize

The size of the page of results to return.

totalRecords

The total number of matched users.

Return Value

A MembershipUserCollection collection that contains a page of pageSizeMembershipUser objects beginning at the page specified by pageIndex.

FindUsersByName returns a list of membership users where the user name matches the supplied usernameToMatch for the configured ApplicationName property. If your data source supports additional search capabilities, such as wildcard characters, you can provide more extensive search capabilities for user names.

The results returned by FindUsersByName are constrained by the pageIndex and pageSize parameters. The pageSize parameter identifies the number of MembershipUser objects to return in the MembershipUserCollection collection. The pageIndex parameter identifies which page of results to return, where 0 identifies the first page. The totalRecords parameter is an out parameter that is set to the total number of membership users that matched the usernameToMatch value. For example, if 13 users were found where usernameToMatch matched part of or the entire user name, and the pageIndex value was 1 with a pageSize of 5, then the MembershipUserCollection would contain the sixth through the tenth users returned. totalRecords would be set to 13.

For an example of a MembershipProvider implementation, see Implementing a Profile Provider.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft