DownloadFile throws Internal Server Error
<p>This code throws exception. How to fix it?</p>

<pre><code>string uriString = "http://www.fileserve.com/login.php";

NameValueCollection postvals = new NameValueCollection();
postvals.Add("loginUserName", "aaaa");
postvals.Add("loginUserPassword", "xxxx");
postvals.Add("autoLogin", "on");
postvals.Add("loginFormSubmit", "Login");

WebClient myWebClient = new WebClient();
myWebClient.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.36 Safari/535.7");
myWebClient.UploadValues(uriString, "POST", postvals);

string cookiestr = myWebClient.ResponseHeaders.Get("Set-Cookie");
myWebClient.Headers.Add("Cookie", cookiestr);
myWebClient.DownloadFile(new Uri("http://fileserve.com/file/2jkYtZS"), "C:\\temp\\" + Path.GetFileName("http://www.fileserve.com/file/2jkYtZS/some.avi"));
</code></pre>

<p>Exception is thrown by myWebClient.DownloadFile() method.:</p>

<pre><code> The remote server returned an error: (500) Internal Server Error.
      at System.Net.WebClient.DownloadFile(Uri address, String fileName)
   at SimonDownloader2.Program.Main(String[] args) in C:\Users\Simon\Workspace\C#\Projects\SerialDownloader2\SerialDownloader2\Program.cs:line 32
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
</code></pre>
