ActiveDirectoryMembershipProvider.GetUser Method (String, Boolean)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

[DirectoryServicesPermissionAttribute(SecurityAction.Assert, 
	Unrestricted = true)]
[DirectoryServicesPermissionAttribute(SecurityAction.Demand, 
	Unrestricted = true)]
[DirectoryServicesPermissionAttribute(SecurityAction.InheritanceDemand, 
	Unrestricted = true)]
public override MembershipUser GetUser(
	string username,
	bool userIsOnline
)

Parameters

username
Type: System.String

The name of the user to get information for.

userIsOnline
Type: System.Boolean

The GetUser method ignores this parameter.

Return Value

Type: System.Web.Security.MembershipUser

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.

Exception Condition
ArgumentException

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.

ArgumentNullException

username is null.

InvalidOperationException

The GetUser method is called before the ActiveDirectoryMembershipProvider instance is initialized.

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.

.NET Framework
Available since 2.0
Return to top
Show: