Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not create SSL/TLS Secure Channel

I'm only sometimes getting this error - it seems like it only happens sometimes. If I refresh the page, it seems to fix itself. Any ideas?

The request was aborted: Could not create SSL/TLS secure channel. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.

From this code:

    string ThirdURL = "https://api.facebook.com/method/users.getInfo?uids=" + FacebookUserID + "&client_id=" + AppCode.Facebook.APPLICATION_ID + "&access_token=" + AccessToken + "&fields=first_name,last_name,current_location,email,birthday,sex,pic_square,locale&format=json";
    HttpWebRequest APIThirdRequest = (HttpWebRequest)WebRequest.Create(ThirdURL);
    StreamReader APIThirdResponse = new StreamReader(APIThirdRequest.GetResponse().GetResponseStream());

//error on line below -->
        string MoreAPIData = APIThirdResponse.ReadToEnd();
like image 396
kevin Avatar asked Nov 14 '22 03:11

kevin


1 Answers

This was a temporary issue from Facebook's side. While it lasted an solution was to do a "try-catch loop" with x amount of max retries of the request, even if it might be considered bad practice.

The issue itself is resolved since 2012-07-17.

Tickets on Facebook Developers about the issue:

  • The request was aborted: Could not create SSL/TLS secure channel.
  • Intermitent SSL certificate errors: "Could not create SSL/TLS secure channel."
like image 71
Robin Andersson Avatar answered Nov 16 '22 02:11

Robin Andersson