Before downloading a file from a link, I need to get some of its data (name, size, Content-type etc.)
WebResponse response = null;
using (token.Token.Register(() => client.Abort(), useSynchronizationContext: false))
{
response = await Task.Run(() => client.GetResponseAsync()).ConfigureAwait(true);
token.Token.ThrowIfCancellationRequested();
}
after I check the client type and get the necessary information. But there is a type of links for which I can’t get the data. When calling
response = await Task.Run (() => client.GetResponseAsync ())
error 404 is returned. What to do? I take an example of links with https://www.mp3juices.cc/
The download address you requested does not apply to WebRequest processing, it does not point to a web page or file.
When accessing the URL, it is actually processed by the website processing program and returns the file.
WebRequest
directly accesses the URL and cannot get the returned data.If you want to verify this, you can use BackgroundDownloader to directly download the file corresponding to the URL.
Thanks.