Bagikan melalui


ClientCredentials.Windows Properti

Definisi

Mendapatkan objek yang digunakan untuk mengontrol kredensial Windows yang digunakan klien untuk mengautentikasi dirinya ke layanan.

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

Nilai Properti

WindowsClientCredential yang mewakili kredensial Windows saat ini.

Contoh

Kode berikut menunjukkan cara menggunakan objek yang dikembalikan oleh properti ini untuk mengonfigurasi tingkat peniruan.

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

Keterangan

Anda dapat menggunakan objek yang dikembalikan oleh properti ini untuk mengonfigurasi kredensial Windows dengan memanggil anggotanya, seperti AllowNtlm dan AllowedImpersonationLevel.

Pengaturan ini mengontrol kredensial Windows yang digunakan selama negosiasi SPNEGO pada tingkat pesan atau transportasi atau properti token Kerberos yang digunakan untuk autentikasi di tingkat pesan.

Berlaku untuk