Hi @Kmcnet,
First, I looked up the documentation at Microsoft Docs and tested the examples.
Then I looked at the information of the relevant code, and there are no variables involved here. So I brought your code straight in for testing.
I found that your code can't read the information in the URL.
I think you can modify the code a bit:
HttpClientHandler handler = new HttpClientHandler { Credentials = new NetworkCredential(UserName, Password) };
handler.ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true;
using (var client = new HttpClient(handler))
{
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
byte[] fileBytes = await client.GetByteArrayAsync(uri);
File.WriteAllBytes(CSVPath, fileBytes);
}
change to
HttpClientHandler handler = new HttpClientHandler { Credentials = new NetworkCredential(UserName, Password) };
handler.ServerCertificateCustomValidationCallback = ServerCertificateCustomValidation;
using (var client = new HttpClient(handler))
{
byte[] fileBytes = await client.GetByteArrayAsync(uri);
File.WriteAllBytes(CSVPath, fileBytes);
}
For more you can check out the documentation:
Of course, this could also be an issue with the URL.
Best Regards
Qi You
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.