ClientCredentials.UserName 屬性

定義

取得認證物件,您可以使用此物件來設定用戶端向服務驗證本身時所使用的使用者名稱和密碼。

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

屬性值

表示目前 UserName 認證的 UserNamePasswordClientCredential

範例

下列程式碼會示範如何設定認證。

// Configure the proxy with
// (username,password).
calcClient.ClientCredentials.UserName.UserName = "username";
calcClient.ClientCredentials.UserName.Password = "changethispassword";
' Configure the proxy with 
' (username,password).
calcClient.ClientCredentials.UserName.UserName = "username"
calcClient.ClientCredentials.UserName.Password = "changethispassword"

備註

您可以使用這個屬性傳回的物件,透過呼叫其成員 (例如 UserNamePassword) 來設定認證。

適用於