HttpTransportBindingElement.AuthenticationScheme 속성

정의

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

속성 값

AuthenticationSchemes

클라이언트 인증에 사용되는 프로토콜을 지정하는 AuthenticationSchemes 열거형의 열거형 값 중 하나입니다. 기본값은 Anonymous입니다.

예외

AuthenticationSchemes의 값이 이미 설정되어 있는 경우

예제

다음 예제에서는 클라이언트 요청을 인증할 때 이 속성을 사용하도록 설정합니다.

[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);  

설명

인증 체계는 한 번만 설정할 수 있습니다.

적용 대상