Author: nevafuse | Posted on: 12/12/2008 7:23:12 PM | Views : 488

I'm trying to create a program to download a file from a web server.  Unfortunately the web server is out of my control and requires a post value before the file begins downloading.  I've research several ways to post values and downloading a file, but nothing combining the two.

string url = "http://theaddress.com/download.php";
NameValueCollection formData = new NameValueCollection();
formData["accept"] = "1";
WebClient webClient = new WebClient();
byte[] responseBytes = webClient.UploadValues(url, "POST", formData);This example will post the values I want, but it starts loading the file into the responseBytes variable. Unfortunately, the file is quite large, so I need to open a readable stream and download it to a local file. (By ope ...

Go to the complete details ...