3

Hello Guys i Have a Problem in WebClient the Problem is i can't download a specific file using WebClient.downloadFile Or WebClient.DownloadFileAsync the Erorr is [ The Request Was Aborted: Could Not Create a SSL/TLS Secure Channel] and the downloaded files is 0bytes Please Help me with any code thats download a file or a give a soultion for my Problem My Code is :

WebClient Client = new WebClient(); Client.DownloadFile("https://github.com/MohammedZr/roepo/blob/master/x82bit/32bit.exe", @"C:\Users\MohamedAlzurghni\Desktop\Project\bolo\test\32bit.exe"); 

2 Answers 2

6

Set the security protocol to Tls12

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; WebClient Client = new WebClient(); Client.DownloadFile("https://github.com/MohammedZr/roepo/blob/master/x82bit/32bit.exe", @"C:\Users\MohamedAlzurghni\Desktop\Project\bolo\test\32bit.exe"); 
Sign up to request clarification or add additional context in comments.

Comments

0

As per the error, the connection is not established on TLS.

WebClient Client = new WebClient(); Client.DownloadFile(new Uri("https://github.com/MohammedZr/enchantress/blob/master/x82bit/xmrig.exe"), @"C:\Users\MohamedAlzurghni\Desktop\Project\bolo\test\32bit.exe"); 

You have to set the security protocol used by your servicepoint.

16 Comments

thanks man for the quick answer i edited my code and now throwing an new error [ the request was aborted the connection was closed unexpectedly ] and the file size is 0 bytes any help ? thanks alot
i edited my comment thanks for the fast reply i'm really grateful
the same problem the file size is 0 bytes
It means no file exists at that path. Would you confirm it?
i fix it the problem is in headers i add this header C# Client.Headers.Add("user-agent", "Mozilla"); C#
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.