Export (0) Print
Expand All

ClientCredentials.Windows Property

Gets an object used to control the Windows credential that the client uses to authenticate itself to the service.

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

public WindowsClientCredential Windows { get; }

Property Value

Type: System.ServiceModel.Security.WindowsClientCredential
A WindowsClientCredential that represents the current Windows credential.

You can use the object returned by this property to configure the Windows credential by calling its members, such as AllowNtlm and AllowedImpersonationLevel.

These settings control the Windows credential used during SPNEGO negotiation at either the message or transport level or the properties of Kerberos tokens used for authentication at the message level.

The following code shows how to use the object returned by this property to configure the impersonation level.


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


.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2014 Microsoft