PrincipalContext.ValidateCredentials 方法

定義

建立與伺服器的連接,並在連接成功時驗證指定的認證。

多載

ValidateCredentials(String, String)

建立與伺服器的連線,並且傳回指出指定的使用者名稱和密碼是否有效的布林值。

ValidateCredentials(String, String, ContextOptions)

建立與伺服器的連線,並且傳回指出指定的使用者名稱和密碼是否有效的布林值。 這個方法會執行使用者名稱和密碼的快速認證驗證。

備註

userName此方法兩個多載中的自變數都必須採用使用者名稱 (格式,例如 mcampbell) ,而不是 domain\usernameusername@domain

ValidateCredentials(String, String)

來源:
Context.cs
來源:
Context.cs
來源:
Context.cs

建立與伺服器的連線,並且傳回指出指定的使用者名稱和密碼是否有效的布林值。

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

參數

userName
String

在伺服器上驗證的使用者名稱。 如需 userName 格式的詳細資訊,請參閱<備註>一節。

password
String

在伺服器上驗證的密碼。

傳回

如果認證有效則為 true,否則為 false

備註

方法 ValidateCredentials 會系結至建構函式中指定的伺服器。 username如果 和 password 自變數為 null,這個方法會驗證目前主體的默認認證。

userName 變數的格式必須是 userName (,例如 mcampbell) ,而不是 domain\usernameusername@domain

適用於

ValidateCredentials(String, String, ContextOptions)

來源:
Context.cs
來源:
Context.cs
來源:
Context.cs

建立與伺服器的連線,並且傳回指出指定的使用者名稱和密碼是否有效的布林值。 這個方法會執行使用者名稱和密碼的快速認證驗證。

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

參數

userName
String

在伺服器上驗證的使用者名稱。 如需 userName 格式的詳細資訊,請參閱<備註>一節。

password
String

在伺服器上驗證的密碼。

options
ContextOptions

一個或多個 ContextOptions 列舉值的組合,供選項用來繫結至伺服器。 這個參數只能指定具有或不具有 SSL 的簡單繫結,或者交涉繫結。

傳回

如果認證有效則為 true,否則為 false

例外狀況

當內容類型為 Machine 時,options 參數必須指定 Negotiate

備註

方法 ValidateCredentials 會系結至建構函式中指定的伺服器。 username如果 和 password 參數為 null,這個方法會驗證目前主體的默認認證。

userName 變數的格式 必須是用戶名稱 (,例如 mcampbell) ,而不是 domain\usernameusername@domain

適用於