ClientCredentials.Windows Egenskap

Definition

Hämtar ett objekt som används för att styra Windows autentiseringsuppgifter som klienten använder för att autentisera sig själv till tjänsten.

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

Egenskapsvärde

En WindowsClientCredential som representerar den aktuella Windows autentiseringsuppgiften.

Exempel

Följande kod visar hur du använder objektet som returneras av den här egenskapen för att konfigurera personifieringsnivån.

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

Kommentarer

Du kan använda objektet som returneras av den här egenskapen för att konfigurera Windows autentiseringsuppgifter genom att anropa dess medlemmar, till exempel AllowNtlm och AllowedImpersonationLevel.

De här inställningarna styr Windows autentiseringsuppgifter som användes under SPNEGO-förhandlingen på meddelande- eller transportnivå eller egenskaperna för Kerberos-token som används för autentisering på meddelandenivå.

Gäller för