System.Web.Profile.ProfileManager.FindProfilesByUserName Method

Retrieves all profile information for profiles in which the user name matches the specified name.

Syntax

public static ProfileInfoCollection FindProfilesByUserName (ProfileAuthenticationOption authenticationOption, string usernameToMatch)

Parameters

authenticationOption
One of the System.Web.Profile.ProfileAuthenticationOption enumeration values, specifying whether anonymous, authenticated, or both types of profiles are returned.
usernameToMatch
The user name for which to search.

Returns

A System.Web.Profile.ProfileInfoCollection containing user profile information for profiles where the user name matches the supplied usernameToMatch parameter.

Remarks

The ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption, string) method returns a list of all profile information for which the user name matches the supplied usernameToMatch parameter value for the configured ProfileManager.ApplicationName property value. Use the authenticationOption parameter to specify whether you want only anonymous profiles, only authenticated profiles, or all profiles to be searched.

You can retrieve profile information for user profiles in pages of data using the overload for the ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption, string, int, int, Int32@) method that takes additional pageIndex and pageSize parameters.

Note that your profile provider may support wildcard characters in the usernameToMatch parameter. For example, the SqlProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, string, int, int, Int32@) method of the System.Web.Profile.SqlProfileProvider class supports wildcard characters in the usernameToMatch parameter.

The ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption, string) method calls the ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, string, int, int, Int32@) method of the default profile provider. The default profile provider is specified using the defaultProvider attribute of the profile configuration element. If the user profile contains properties that are managed by a profile provider other than the default provider, the data source for the other profile provider is not searched. To find profiles that are managed by a profile provider other than the default provider, obtain a reference to the profile provider using the ProfileManager.Providers property and call the ProfileProvider.FindProfilesByUserName(ProfileAuthenticationOption, string, int, int, Int32@) method of the provider directly.

Requirements

Namespace: System.Web.Profile
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0