ClientCredentials.Windows 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取用于控制客户端用于使自身通过到服务的身份认证的 Windows 凭据的对象。
public:
property System::ServiceModel::Security::WindowsClientCredential ^ Windows { System::ServiceModel::Security::WindowsClientCredential ^ get(); };
public System.ServiceModel.Security.WindowsClientCredential Windows { get; }
member this.Windows : System.ServiceModel.Security.WindowsClientCredential
Public ReadOnly Property Windows As WindowsClientCredential
属性值
一个 WindowsClientCredential,表示当前的 Windows 凭据。
示例
下面的代码演示如何使用此属性返回的对象配置模拟级别。
// Create a client object with the given client endpoint configuration.
CalculatorClient client = new CalculatorClient();
try
{
client.ClientCredentials.Windows.AllowedImpersonationLevel
= TokenImpersonationLevel.Impersonation;
}
catch (TimeoutException timeProblem)
{
Console.WriteLine("The service operation timed out. " + timeProblem.Message);
Console.ReadLine();
client.Abort();
}
catch (CommunicationException commProblem)
{
Console.WriteLine("There was a communication problem. " + commProblem.Message + commProblem.StackTrace);
Console.ReadLine();
client.Abort();
}
' Create a client object with the given client endpoint configuration.
Dim client As New CalculatorClient()
Try
client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation
Catch timeProblem As TimeoutException
Console.WriteLine("The service operation timed out. " & timeProblem.Message)
Console.ReadLine()
client.Abort()
Catch commProblem As CommunicationException
Console.WriteLine("There was a communication problem. " & commProblem.Message + commProblem.StackTrace)
Console.ReadLine()
client.Abort()
End Try
注解
您可以使用此属性返回的对象配置 Windows 凭据,方法是调用该凭据的成员,如 AllowNtlm 和 AllowedImpersonationLevel。
这些设置控制在消息或传输级别的 SPNEGO 协商期间使用的 Windows 凭据或用于消息级别的身份验证的 Kerberos 令牌的属性。