Simon Dugré Simon Dugré - 7 months ago 185
ASP.NET (C#) Question

The request was aborted: Could not create SSL/TLS secure channel

We are unable to connect to an HTTPS server using

because of this error message:

The request was aborted: Could not create SSL/TLS secure channel.

We know that the server doesn't have a valid HTTPS certificate with the path used, but to bypass this issue, we use the following code that we've taken from another StackOverflow post:

private void Somewhere() {
ServicePointManager.ServerCertificateValidationCallback += new RemoteCertificateValidationCallback(AllwaysGoodCertificate);

private static bool AllwaysGoodCertificate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors policyErrors) {
return true;

The problem is that server never validates the certificate and fails with the above error. Does anyone have any idea of what should I do?

I should mention that a colleague and I performed tests a few weeks ago and it was working fine with something similar to what I wrote above. The only "major difference" we've found is that I'm using Windows 7 and he was using Windows XP. Does that change something?


Wow, I finally found it (I haven't note my source but it was from a google search);

While the code works in Windows XP, in Windows 7, you must add this at the beginning:

ServicePointManager.Expect100Continue = true;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;

And now, it works perfectly.

Thank you guys!


Many payment gateways (e.g. PayPal) are now dropping support for SSLv3 - recommend use of TLS instead i.e.

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

If you do not yet have .NET framework 4.5 yet, this is equivalent:

ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;


As mentionned by Robin French; PayPal have set a date of June 30 2017 to disable SSL3 and implement TLS1.2. It is already applied in their sandbox environment : Paypal Info Page