次の方法で共有


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 列挙の列挙値の 1 つ。 既定値は、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);

注釈

認証方式は、1 回だけ設定できます。

適用対象