Export (0) Print
Expand All

HttpTransportBindingElement.AuthenticationScheme Property

Gets or sets the authentication scheme used to authenticate client requests being processed by an HTTP listener.

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

public AuthenticationSchemes AuthenticationScheme { get; set; }
/** @property */
public AuthenticationSchemes get_AuthenticationScheme ()

/** @property */
public void set_AuthenticationScheme (AuthenticationSchemes value)

public function get AuthenticationScheme () : AuthenticationSchemes

public function set AuthenticationScheme (value : AuthenticationSchemes)

Not applicable.

Property Value

The AuthenticationSchemes enumeration that specifies the protocols used for client authentication. The default is Anonymous.

Exception typeCondition

ArgumentException

The value for the AuthenticationSchemes was already set.

The authentication scheme can only be set once.

[C#] The following example sets this property to use when authenticating client requests.

[ServiceContract]

interface ICalculator

{

[OperationContract]

Int Add(int a, int b);

}

HttpTransportBindingElement httpBinding = new HttpTransportBindingElement();

httpBinding.AuthenticationScheme = AuthenticationSchemes.Digest;

CustomBinding binding = new CustomBinding(new TextMessageEncodingBindingElement(), httpBinding);

EndpointAddress endpoint = new EndpointAddress(address);

ChannelFactory<ICalculator> proxy = new ChannelFactory<ICalculator>(binding, endpoint);

proxy.Credentials.Windows.ClientCredential = new NetworkCredential("user", "password", "domain");

proxy.Credentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;

proxy.Open();

ICalculator calc = proxy.CreateChannel();

int foo=calc.Add(5,4);

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

Community Additions

ADD
Show:
© 2014 Microsoft