WindowsClientCredential::ClientCredential Property
.NET Framework (current version)
Gets or sets the Windows client credential.
Assembly: System.ServiceModel (in System.ServiceModel.dll)
public: property NetworkCredential^ ClientCredential { NetworkCredential^ get(); void set(NetworkCredential^ value); }
By default, the current thread's credentials are used by WCF for doing Windows SSPI Negotiate authentication.
To authenticate the client as another principal, change the properties of the instance of the NetworkCredential class that is returned by this property. Alternatively, create a new instance of the NetworkCredential class and assign it to this property.
The following code examples show how to authenticate the client as a different principal.
This is how to change the properties of the instance of the NetworkCredential class that is returned by this property.
private void Snippet2() { using (CalculatorClient client = new CalculatorClient()) { client.ClientCredentials.Windows.ClientCredential.UserName = "test"; client.ClientCredentials.Windows.ClientCredential.Password = "password"; } }
This is how to create a new instance of the NetworkCredential class and assign it to this property.
private void Snippet3() { using (CalculatorClient client = new CalculatorClient()) { client.ClientCredentials.Windows.ClientCredential = new NetworkCredential("test user", "password"); } }
Universal Windows Platform
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Available since 8
.NET Framework
Available since 3.0
Portable Class Library
Supported in: portable .NET platforms
Show: