Joseph Anderson
Joseph Anderson

Reputation: 4144

Windows Azure Cloud App - Could not create SSL/TLS secure channel

I am trying to pull JSON from a customer's website, but I get this error.

  1. The code works my local machine.
  2. For other sites, both on my local machine and on the server, the code works.
  3. The site is https://www.vapedepot.ca/wc-api/v1

Does he have a special SSL cert where I need to change my code? Here is my code:

    string GetJson(string url)
    {
        string resultData = string.Empty;
        HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
        myHttpWebRequest.Accept = "application/json";
        myHttpWebRequest.Timeout = 6000;
        //myHttpWebRequest.ContentType = "application/x-www-form-urlencoded";
        string userP = m_UserName + ":" + m_Password;
        byte[] authBytes = Encoding.UTF8.GetBytes(userP).ToArray();
        myHttpWebRequest.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(authBytes));
        WebResponse httpResponse = myHttpWebRequest.GetResponse();
        Stream responseStream = httpResponse.GetResponseStream();
        StreamReader reader = new StreamReader(responseStream);
        resultData = reader.ReadToEnd();
        responseStream.Close();
        httpResponse.Close();
        return resultData;
    }

He is using CloudFlare and the SSL uses ecdsa.

Upvotes: 2

Views: 725

Answers (1)

Ashley Poole
Ashley Poole

Reputation: 101

I had the same issue. I swapped to using RestSharp to make my secure web requests and it resolved my issue.

Upvotes: 2

Related Questions