i\'m trying to download a file from a link that doesn\'t contain the file, but instead it redirects to another (temporary) link that contains the actual file. The objective
I guess the easy option is simply this (after what you've got there.. and the URL you provided in place of http://www.contoso.com):
using (var responseStream = myHttpWebResponse.GetResponseStream()) {
using (var fileStream =
new FileStream(Path.Combine("folder_here", "filename_here"), FileMode.Create)) {
responseStream.CopyTo(fileStream);
}
}
EDIT:
In fact, this won't work. It isn't a HTTP redirect that downloads the file. Look at the source of that page.. you'll see this:
It basically uses the browser to redirect. Unfortunately what you're trying to do won't work.