dimanche 5 juin 2016

Unable to download file (page url same as download url)

I'm trying to download a zip file (that is normally accessed/downloaded by pressing a button on a web page) using C#.

Normally the file is downloaded by selecting "Data Export" and then clicking the "SEARCH" button at this URL:

http://ift.tt/1VGDb2n

If trigger the download manually on the webpage and then copy the download url from the 'Downloads' view of chrome or firefox I get the exact same URL as above. When I paste that in a browser window I will not trigger the download, instead the above page will be loaded and I have to trigger the download manually in the same way as in the first place. I've also tried using the network tab of the inspector to copy the request header of the request that is triggered when clicking the "SEARCH" button, but that URL is also the same as the one above.

Trying with C# I get the same result, the page itself is downloaded. My code looks as follows:

        using (var client = new WebClient())
        {
            client.DownloadFile("http://ift.tt/24rZJ7p", "zipfile.zip");
        }

My guess is that my code is correct, but how do I get the correct URL to be able to download the file directly?




Aucun commentaire:

Enregistrer un commentaire