HttpDigestClientCredential::ClientCredential Property

 

Gets or sets the network credential to be used for digest-based authentication.

Namespace:   System.ServiceModel.Security
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public:
property NetworkCredential^ ClientCredential {
	NetworkCredential^ get();
	void set(NetworkCredential^ value);
}

Property Value

Type: System.Net::NetworkCredential^

The NetworkCredential to be used for digest-based authentication.

If not specified, the default thread credential will be used.

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.HttpDigest.ClientCredential.UserName = "test";
        client.ClientCredentials.HttpDigest.ClientCredential.Password = "password";
    }
}

And here 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.HttpDigest.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
Return to top
Show: