This documentation is archived and is not being maintained.

ClientBase.ClientCredentials Property

Gets the client credentials used to call an operation.

Namespace: System.ServiceModel
Assembly: System.ServiceModel (in system.servicemodel.dll)

public ClientCredentials ClientCredentials { get; }
/** @property */
public ClientCredentials get_ClientCredentials ()

public function get ClientCredentials () : ClientCredentials

Not applicable.

Property Value

Returns a System.ServiceModel.Description.ClientCredentials that represents the proof of identity presented by the client.

Use the ClientCredentials property to configure the credentials that the ClientBase object uses to connect to the service.

The following code shows how to use the ClientCredentials property to set the username and password prior to calling the service.

// 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();

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0
Show: