B
B
bqio2018-12-07 19:52:26
C++ / C#
bqio, 2018-12-07 19:52:26

Why is an empty file being downloaded via the Web Client?

Invoke(new EventHandler(delegate
            {
                var Client = new WebClient();
                Client.DownloadFileCompleted += new AsyncCompletedEventHandler(Client_DownloadFileCompleted);
                Client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(Client_DownloadProgressChanged);
                Client.DownloadFileAsync(new Uri($"{ServerUrl}{File.Path}"), Path.GetFileNameWithoutExtension(File.Path));
            }));

The file is 100% present on the server. I read somewhere that you need to somehow indicate in the code that we are like a "real browser" and then the site will let us through.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
shai_hulud, 2018-12-07
@shai_hulud

Specify the user-agent request header, as in the browser. Perhaps before requesting a file, you will need to request the page from which it is downloaded.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question