Click here to Skip to main content
13,793,266 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have tried this code but error is showing this "The request was aborted: Could not create SSL/TLS secure channel."

What I have tried:

var uri = String.Format("https://blockchain.info/tobtc?currency=USD&value={0}", val);

WebClient client = new WebClient();
client.UseDefaultCredentials = true;
var data = client.DownloadString(uri);

var result = Convert.ToDouble(data);
decimal dss = Convert.ToDecimal(result);
lblbitcoin.Text = Convert.ToString(dss);
string vsss = Convert.ToString(lblbitcoin.Text);
lblbitcoin.Text = Convert.ToString(vsss.Substring(0, 6));
Posted 19-Sep-18 21:12pm
Updated 20-Sep-18 3:31am

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

That server requires TLS 1.1 as a minimum. Prior to .NET 4.5.2, TLS 1.1 was not enabled by default.

If you can upgrade your application to .NET 4.5.2 or higher, this will enable TLS 1.1 by default. If possible, you should upgrade to 4.6 or higher, which will also enable TLS 1.2 by default.

If you can't upgrade, and you're on .NET 4.5, you can enable the correct versions of TLS by changing the registry:
Enable TLS 1.1 and TLS 1.2 support in Office Online Server | Microsoft Docs[^]

If you're stuck on 3.5, there's a hotfix you'll need to install:
Support for TLS System Default Versions included in the .NET Framework 3.5 on Windows Server 2012[^]

You may also want to review Microsoft's guidance:
Transport Layer Security (TLS) best practices with the .NET Framework | Microsoft Docs[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.181207.3 | Last Updated 20 Sep 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100