Пример #1
0
        TransportBindingElement GetTransport()
        {
            Channels.HttpTransportBindingElement h;
            switch (Security.Mode)
            {
            default:
                h = new Channels.HttpTransportBindingElement();
                break;
            }
            h.AllowCookies             = AllowCookies;
            h.BypassProxyOnLocal       = BypassProxyOnLocal;
            h.HostNameComparisonMode   = HostNameComparisonMode;
            h.MaxBufferPoolSize        = MaxBufferPoolSize;
            h.MaxBufferSize            = MaxBufferSize;
            h.MaxReceivedMessageSize   = MaxReceivedMessageSize;
            h.ProxyAddress             = ProxyAddress;
            h.UseDefaultWebProxy       = UseDefaultWebProxy;
            h.TransferMode             = TransferMode;
            h.ExtendedProtectionPolicy = Security.Transport.ExtendedProtectionPolicy;
            switch (Security.Transport.ClientCredentialType)
            {
            case HttpClientCredentialType.Basic:
                h.AuthenticationScheme = AuthenticationSchemes.Basic;
                break;

            case HttpClientCredentialType.Ntlm:
                h.AuthenticationScheme = AuthenticationSchemes.Ntlm;
                break;

            case HttpClientCredentialType.Windows:
                h.AuthenticationScheme = AuthenticationSchemes.Negotiate;
                break;

            case HttpClientCredentialType.Digest:
                h.AuthenticationScheme = AuthenticationSchemes.Digest;
                break;

            case HttpClientCredentialType.Certificate:
                switch (Security.Mode)
                {
                case BasicHttpSecurityMode.Transport:
                    break;

                case BasicHttpSecurityMode.TransportCredentialOnly:
                    throw new InvalidOperationException("Certificate-based client authentication is not supported by 'TransportCredentialOnly' mode.");
                }
                break;
            }
            return(h);
        }
Пример #2
0
 public HttpBindingProperties(HttpTransportBindingElement source)
 {
     this.source = source;
 }