HttpWebRequest over SSL?

I used HttpWebRequests to send data to HTTPS websites before, and I never had anything other than plain HTTP mail.

Does anyone know if there are any tricks I missed to make sure this was done correctly?

+3
source share
4 answers

After a little search, it looks like you don't need to do anything if the certificate is valid.

If you want to verify the certificate yourself, you can do this:

System.Net.ServicePointManager.ServerCertificateValidationCallback +=
    delegate(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate,
                            System.Security.Cryptography.X509Certificates.X509Chain chain,
                            System.Net.Security.SslPolicyErrors sslPolicyErrors)
        {
            return true; // **** Always accept
        };

The above code was obtained from a comment by Rick Strals and will force the client certificate to be accepted.

You can also check the certificate there in this deletet.

Cool stuff!

+4
source

, https - , ( ), ssl/tls, DNS ( http) . , / .

, , - . SSO . - , https.

+1

HTTPS- , HTTP ( SSL).

, ( ), , , .

0
source

Source: https://habr.com/ru/post/1698815/


All Articles