The prompt that we usually get when downloading a file from a website using the IE is hampering the download of a tar file for me .
I am using C# .
Here is the code snippet .
WebClient wc = new WebClient();
wc.DownloadFileAsync(@”www.somelink.com”, @”C:\a.tgz”);
What i get is not a valid a.tgz file.
I am assuming its downloading some content related to the save/open dialog given by the internet browser .
How do I by pass it ?
Are you downloading the entire file? It could be the download is being interrupted prematurely.
The save/open dialog is not a problem, as that is IE’s method of displaying non-HTML content. However if the website is responding with a webpage then that could be your problem (for instance “You need to be logged in to proceed” or “Click here to download the file”).
Try renaming the file to html and see if you can read it then. Alternatively you can load it in notepad to see if it is plaintext if you are afraid of what the contents are for any reason.
EDIT:
You may also not be fully downloading the file, given the description on MSDN of the methodology, an empty file is placed at the target location, the file is downloaded to a temporary location, then finally it is moved to the target, if the download is being interrupted, by say the program exiting, that would explain the problem you are experiencing.
Short version: Try downloading synchronously and see if that works better.