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

属性值

一个 UserNamePasswordClientCredential,表示当前的 UserName 凭据。

示例

下面的代码演示如何配置凭据。

// 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

适用于