Bagikan melalui


ClientBase<TChannel>.ClientCredentials Properti

Definisi

Mendapatkan kredensial klien yang digunakan untuk memanggil operasi.

public:
 property System::ServiceModel::Description::ClientCredentials ^ ClientCredentials { System::ServiceModel::Description::ClientCredentials ^ get(); };
public System.ServiceModel.Description.ClientCredentials ClientCredentials { get; }
member this.ClientCredentials : System.ServiceModel.Description.ClientCredentials
Public ReadOnly Property ClientCredentials As ClientCredentials

Nilai Properti

Bukti identitas yang disajikan oleh klien.

Contoh

Kode berikut menunjukkan cara menggunakan ClientCredentials properti untuk mengatur nama pengguna dan kata sandi sebelum memanggil layanan.

// Specify client credentials on the client.
// Code to set the UserName and Password is not shown here.
CalculatorClient CalculatorClient = new CalculatorClient("myBinding");
CalculatorClient.ClientCredentials.UserName.UserName = ReturnUserName();
CalculatorClient.ClientCredentials.UserName.Password = ReturnPassword();
' Specify client credentials on the client. 
' Code to set the UserName and Password is not shown here.
Dim CalculatorClient As New CalculatorClient("myBinding")
CalculatorClient.ClientCredentials.UserName.UserName = ReturnUserName()
CalculatorClient.ClientCredentials.UserName.Password = ReturnPassword()

Keterangan

ClientCredentials Gunakan properti untuk mengonfigurasi kredensial yang ClientBase<TChannel> digunakan objek untuk menyambungkan ke layanan.

Berlaku untuk

Lihat juga