W
W
WisdomButcher2020-09-24 21:21:06
C++ / C#
WisdomButcher, 2020-09-24 21:21:06

How to download a file from the internet using WebClient?

Good evening!
Wrote a code for downloading a file over the network in .net core Linux:

var link = "https://www.atsenergo.ru/nreport?fid=AFFD00AEC4F50010E053AC103C8C9DB4";
        var net = new System.Net.WebClient();
        byte[] file = net.DownloadData(link);

Executing the last line throws an exception:
Exception has occurred: CLR/System.Net.WebException
An exception of type 'System.Net.WebException' occurred in System.Net.WebClient.dll but was not handled in user code: 'The SSL connection could not be established, see inner exception. Authentication failed, see inner exception.'
Inner exceptions found, see $exception in variables window for more details.
Innermost exception Interop.Crypto.OpenSslCryptographicException : error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type
What is missing for the program to work? By http, https ya.ru downloads.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2020-09-24
@freeExec

TLS1.3 problem, only TLS1.2 and below should be limited.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question