I'm trying to download from a specific URL using this code:
var requestUri = "https://github.com/gus33000/MSM8994-8992-NT-ARM64-Drivers/archive/master.zip";
using (var client = new HttpClient())
{
using (var response = await client.GetAsync(requestUri, HttpCompletionOption.ResponseHeadersRead))
{
var contentLength = response.Content.Headers.ContentLength;
}
}
If you run the code, you will likely get null
in contentLength
. But, why? Sometimes, the length is returned. What should I do to retrieve the length of the file always?