I cannot download a publicly available file from a government webserver using .Net framework 4.8 or .Net core 3.1. I am able to download the file using Chrome, Firefox, or curl.
WebClient.DownloadFile() worked for over a year as an Azure app service. It failed Sept. 14, 2020 and hasn't worked since. It no longer works on my Windows 10 Pro computer. I also tried HttpWebRequest/HttpWebResponse without luck. I suspect server or firewall rule is blocking the request due to missing Http header? I've tried setting user-agent header and forcing the protocol along with other ServicePointManager properties/overrides with no luck.
WireShark shows client Hello sends TLSv1.2 cipher list. I matched several of these ciphers to the server's list, using SSLLabs server report. After Client Hello, Server responds with [ACK] and then [RST, ACK] and no Server Hello.
` private void DownloadTest()
{
//ServicePointManager.Expect100Continue = true;
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
//ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
try
{
using (var client = new WebClient())
{
client.DownloadFile("https://cops.fas.gsa.gov/awards/awards_2021.csv", @"c:\awards_2021.csv");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
`