Share via


ClientCredentials.HttpDigest 屬性

定義

取得目前的 HTTP 摘要式認證。

public:
 property System::ServiceModel::Security::HttpDigestClientCredential ^ HttpDigest { System::ServiceModel::Security::HttpDigestClientCredential ^ get(); };
public System.ServiceModel.Security.HttpDigestClientCredential HttpDigest { get; }
member this.HttpDigest : System.ServiceModel.Security.HttpDigestClientCredential
Public ReadOnly Property HttpDigest As HttpDigestClientCredential

屬性值

HttpDigestClientCredential

HttpDigestClientCredential,表示當選擇 HTTP 摘要式驗證方法時,用戶端用於向服務進行驗證的認證。

範例

下列程式碼會示範如何使用這個屬性來設定認證使用者名稱和密碼。

private void Snippet2()
{
    using (CalculatorClient client = new CalculatorClient())
    {
        client.ClientCredentials.HttpDigest.ClientCredential.UserName = "test";
        client.ClientCredentials.HttpDigest.ClientCredential.Password = "password";
    }
}

備註

您可以使用這個屬性傳回的物件,透過呼叫 AllowedImpersonationLevel 屬性來設定認證。

同樣地,如果網路認證不同於目前的執行緒權杖,您就可以指定要使用的網路認證。

適用於