HttpTransportBindingElement.AuthenticationScheme Propriété

Définition

Obtient ou définit le modèle d'authentification utilisé pour authentifier les demandes du client qui sont traitées par un écouteur HTTP.

public:
 property System::Net::AuthenticationSchemes AuthenticationScheme { System::Net::AuthenticationSchemes get(); void set(System::Net::AuthenticationSchemes value); };
public System.Net.AuthenticationSchemes AuthenticationScheme { get; set; }
member this.AuthenticationScheme : System.Net.AuthenticationSchemes with get, set
Public Property AuthenticationScheme As AuthenticationSchemes

Valeur de propriété

AuthenticationSchemes

L'une des valeurs d'énumération de l'énumération AuthenticationSchemes qui spécifie les protocoles utilisés pour l'authentification du client. La valeur par défaut est Anonymous.

Exceptions

La valeur de AuthenticationSchemes a déjà été définie.

Exemples

L'exemple suivant définit l'utilisation de cette propriété pour l'authentification des demandes du client.

[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 odd=calc.Add(5,4);  

Remarques

Le modèle d'authentification ne peut être défini qu'une seule fois.

S’applique à