ClientBase<TChannel>.ClientCredentials 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得用來呼叫作業的用戶端認證。
public:
property System::ServiceModel::Description::ClientCredentials ^ ClientCredentials { System::ServiceModel::Description::ClientCredentials ^ get(); };
public System.ServiceModel.Description.ClientCredentials ClientCredentials { get; }
member this.ClientCredentials : System.ServiceModel.Description.ClientCredentials
Public ReadOnly Property ClientCredentials As ClientCredentials
屬性值
用戶端轉譯的身分識別證明。
範例
下列程式碼示範如何使用 ClientCredentials 屬性在呼叫服務前設定使用者名稱和密碼。
// Specify client credentials on the client.
// Code to set the UserName and Password is not shown here.
CalculatorClient CalculatorClient = new CalculatorClient("myBinding");
CalculatorClient.ClientCredentials.UserName.UserName = ReturnUserName();
CalculatorClient.ClientCredentials.UserName.Password = ReturnPassword();
' Specify client credentials on the client.
' Code to set the UserName and Password is not shown here.
Dim CalculatorClient As New CalculatorClient("myBinding")
CalculatorClient.ClientCredentials.UserName.UserName = ReturnUserName()
CalculatorClient.ClientCredentials.UserName.Password = ReturnPassword()
備註
請使用 ClientCredentials 屬性設定 ClientBase<TChannel> 物件用來連接服務的認證。