ActiveDirectoryMembershipProvider.GetUser Method

Definition

Gets the information from a membership user in the Active Directory data store.

Overloads

GetUser(String, Boolean)

Gets the membership user information associated with the specified user name.

GetUser(Object, Boolean)

Gets the membership user information associated with the specified user key.

GetUser(String, Boolean)

Gets the membership user information associated with the specified user name.

public:
 override System::Web::Security::MembershipUser ^ GetUser(System::String ^ username, bool userIsOnline);
public override System.Web.Security.MembershipUser GetUser (string username, bool userIsOnline);
override this.GetUser : string * bool -> System.Web.Security.MembershipUser
Public Overrides Function GetUser (username As String, userIsOnline As Boolean) As MembershipUser

Parameters

username
String

The name of the user to get information for.

userIsOnline
Boolean

The GetUser(String, Boolean) method ignores this parameter.

Returns

A MembershipUser instance representing the user specified. If no user is found in the Active Directory data store for the specified username value, null is returned.

Exceptions

username is empty, or exceeds the maximum length for the user name (usually 256 characters).

-or-

username contains commas.

-or-

The user name is mapped to the userPrincipalName attribute and the username parameter contains backslashes.

username is null.

The GetUser(String, Boolean) method is called before the ActiveDirectoryMembershipProvider instance is initialized.

Remarks

The GetUser method is called by the Membership class to retrieve information on the specified user from the Active Directory data store.

The provider uses a subtree search starting at the search point specified in the connection string. See the ActiveDirectoryMembershipProvider class topic for more information about connection strings.

Leading and trailing spaces are trimmed from the username parameter value.

See also

Applies to

GetUser(Object, Boolean)

Gets the membership user information associated with the specified user key.

public:
 override System::Web::Security::MembershipUser ^ GetUser(System::Object ^ providerUserKey, bool userIsOnline);
public override System.Web.Security.MembershipUser GetUser (object providerUserKey, bool userIsOnline);
override this.GetUser : obj * bool -> System.Web.Security.MembershipUser
Public Overrides Function GetUser (providerUserKey As Object, userIsOnline As Boolean) As MembershipUser

Parameters

providerUserKey
Object

The unique identifier for the user.

userIsOnline
Boolean

The GetUser(Object, Boolean) method ignores this parameter.

Returns

A MembershipUser instance representing the user specified. If no user is found in the Active Directory data store for the specified providerUserKey value, null is returned.

Exceptions

The GetUser(Object, Boolean) method is called before the ActiveDirectoryMembershipProvider instance is initialized.

providerUserKey is not of type SecurityIdentifier.

providerUserKey is null.

Remarks

The GetUser method is called by the Membership class to retrieve information on the specified user from the Active Directory data store.

The search looks for a user instance where the objectSID attribute matches the providerUserKey parameter.

The provider uses a subtree search starting at the search point specified in the connection string. See the ActiveDirectoryMembershipProvider class topic for more information about connection strings.

Applies to