예제 #1
0
        /// <summary>
        /// Configure the SOAP connection for HTTP or HTTPS depending on what was specified
        /// </summary>
        /// <param name="httpBinding"></param>
        /// <param name="uri"></param>
        /// <remarks>Allows self-signed certs to be used</remarks>
        public static void ConfigureBinding(BasicHttpBinding httpBinding, Uri uri)
        {
            //Handle SSL if necessary
            if (uri.Scheme == "https")
            {
                httpBinding.Security.Mode = BasicHttpSecurityMode.Transport;
                httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;

                //Allow self-signed certificates
                PermissiveCertificatePolicy.Enact("");
            }
            else
            {
                httpBinding.Security.Mode = BasicHttpSecurityMode.None;
            }
        }
 public static void Enact(string subjectName)
 {
     currentPolicy = new PermissiveCertificatePolicy(subjectName);
 }