PrincipalContext.ValidateCredentials Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates the connection to the server and validates the specified credentials if the connection is successful.
ValidateCredentials(String, String) |
Creates the connections to the server and returns a Boolean value that specifies whether the specified username and password are valid. |
ValidateCredentials(String, String, ContextOptions) |
Creates the connections to the server and returns a Boolean value that specifies whether the specified user name and password are valid. This method performs fast credential validation of the username and password. |
The userName
argument in both overloads of this method must take the form username (for example, mcampbell) rather than domain\username or username@domain.
- Source:
- Context.cs
- Source:
- Context.cs
- Source:
- Context.cs
Creates the connections to the server and returns a Boolean value that specifies whether the specified username and password are valid.
public:
bool ValidateCredentials(System::String ^ userName, System::String ^ password);
public bool ValidateCredentials (string userName, string password);
member this.ValidateCredentials : string * string -> bool
Public Function ValidateCredentials (userName As String, password As String) As Boolean
Parameters
- userName
- String
The username that is validated on the server. See the Remarks section for more information on the format of userName
.
- password
- String
The password that is validated on the server.
Returns
true
if the credentials are valid; otherwise false
.
Remarks
The ValidateCredentials method binds to the server specified in the constructor. If the username
and password
arguments are null
, this method validates the default credentials for the current principal.
The userName
argument must take the form userName (for example, mcampbell) rather than domain\username or username@domain.
Applies to
.NET 9 (package-provided) und andere Versionen
Produkt | Versionen |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
- Source:
- Context.cs
- Source:
- Context.cs
- Source:
- Context.cs
Creates the connections to the server and returns a Boolean value that specifies whether the specified user name and password are valid. This method performs fast credential validation of the username and password.
public:
bool ValidateCredentials(System::String ^ userName, System::String ^ password, System::DirectoryServices::AccountManagement::ContextOptions options);
public bool ValidateCredentials (string userName, string password, System.DirectoryServices.AccountManagement.ContextOptions options);
member this.ValidateCredentials : string * string * System.DirectoryServices.AccountManagement.ContextOptions -> bool
Public Function ValidateCredentials (userName As String, password As String, options As ContextOptions) As Boolean
Parameters
- userName
- String
The username that is validated on the server. See the Remarks section for information on the format of userName
.
- password
- String
The password that is validated on the server.
- options
- ContextOptions
A combination of one or more ContextOptions enumeration values the options used to bind to the server. This parameter can only specify Simple bind with or without SSL, or Negotiate bind.
Returns
true
if the credentials are valid; otherwise false
.
Exceptions
Remarks
The ValidateCredentials method binds to the server specified in the constructor. If the username
and password
parameters are null
, this method validates the default credentials for the current principal.
The userName
argument must take the form username (for example, mcampbell) rather than domain\username or username@domain.
Applies to
.NET 9 (package-provided) und andere Versionen
Produkt | Versionen |
---|---|
.NET | 8 (package-provided), 9 (package-provided) |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
Feedback zu .NET
.NET ist ein Open Source-Projekt. Wählen Sie einen Link aus, um Feedback zu geben: