Could not create SSL/TLS secure channel RRS feed

  • Question

  • User379720387 posted

    I am doing an integration with PayPal from my Razor C WebPages application.

    HttpWebRequest ppReq = (HttpWebRequest)WebRequest.Create(url);
        ppReq.Method = "POST";
        ppReq.ContentType = "application/x-www-form-urlencoded";
        ppReq.ContentLength = query.Length;
        StreamWriter ppOut = new StreamWriter(ppReq.GetRequestStream(), System.Text.Encoding.ASCII);

    The highlighted line is where the exception occurs. The site has a SSL certificate. 

    How to fix this?

    Tuesday, September 10, 2019 8:12 PM

All replies

  • User665608656 posted

    Hi wavemaster,

    Could not create SSL/TLS secure channel

    For this issue, you can add the following code at the beginning :

    // using System.Net;
    ServicePointManager.Expect100Continue = true;
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
    // Use SecurityProtocolType.Ssl3 if needed for compatibility reasons

    For more details, you could refer to this link : The request was aborted: Could not create SSL/TLS secure channel

    If you are getting this problem while configuring PayPal, please note that they won't support SSL3 starting by December, 3rd 2018. You'll need to use TLS.

    About PayPal, you can refer to this link : https://www.paypal.com/uk/webapps/mpp/ssl-security-update

    Best Regards,


    Wednesday, September 11, 2019 5:26 AM
  • User379720387 posted

    I have implemented the code but have not been able to test it until I get some Paypal issues taken care off.

    Thursday, September 12, 2019 1:52 PM