Export (0) Print
Expand All

PrincipalContext.ValidateCredentials Method (String, String)

Creates the connections to the server and returns a Boolean value that specifies whether the specified username and password are valid.

Namespace:  System.DirectoryServices.AccountManagement
Assembly:  System.DirectoryServices.AccountManagement (in System.DirectoryServices.AccountManagement.dll)

public bool ValidateCredentials(
	string userName,
	string password
)

Parameters

userName
Type: System.String

The username that is validated on the server.

password
Type: System.String

The password that is validated on the server.

Return Value

Type: System.Boolean
true if the credentials are valid; otherwise false.

The ValidateCredentials method binds to the server specified in the constructor. If the username and password parameters are null, the credentials specified in the constructor are validated. If no credential were specified in the constructor, and the username and password parameters are null, this method validates the default credentials for the current principal.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft