ClientCredentials.Windows Właściwość

Definicja

Pobiera obiekt używany do kontrolowania poświadczeń Windows używanych przez klienta do uwierzytelniania się w usłudze.

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

Wartość właściwości

WindowsClientCredential

Element WindowsClientCredential reprezentujący bieżący Windows poświadczenie.

Przykłady

Poniższy kod pokazuje, jak użyć obiektu zwróconego przez tę właściwość w celu skonfigurowania poziomu personifikacji.

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

Uwagi

Możesz użyć obiektu zwróconego przez tę właściwość, aby skonfigurować poświadczenia Windows przez wywołanie jego elementów członkowskich, takich jak AllowNtlm i AllowedImpersonationLevel.

Te ustawienia kontrolują poświadczenia Windows używane podczas negocjacji SPNEGO na poziomie komunikatu lub transportu albo właściwości tokenów Protokołu Kerberos używanych do uwierzytelniania na poziomie komunikatu.

Dotyczy