title: System.Net.WebClient returned not all data from file
body: <p>I try <code>download file via WebClient</code>, but it returned not all bytes from file. <code>Original file has 45Kb</code>, It <code>download only 8kb</code> from total file. It happened after I added <em>user-agent</em> header.</p>
  
  <p>My code is:</p>
  
  <pre><code>using (ZipFile zip = new ZipFile())
  {
       foreach (KeyValuePair&lt;string, string&gt; i in filesToInclude)
       {
           System.Net.WebClient wc = new System.Net.WebClient();
           wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
           wc.UseDefaultCredentials = true;
           wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
           string downloadUrl = SPContext.Current.Site.Url + i.Key;    
           AppClass.WriteToLog(string.Format("downloadUrl: {0}", downloadUrl));
           byte[] img = wc.DownloadData(downloadUrl);
           zip.AddEntry(i.Value, img);
        }
        zip.Save(Response.OutputStream);
      }
  </code></pre>
  
  <p>Have you any ideas?</p>
  
  <p><strong>UPDATE:</strong> in the previous version <code>url</code> doesn't build correctly. I change my code to:</p>
  
  <pre><code>using (ZipFile zip = new ZipFile())
  {
       foreach (KeyValuePair&lt;string, string&gt; i in filesToInclude)
       {
            System.Net.WebClient wc = new System.Net.WebClient();
            wc.Credentials = System.Net.CredentialCache.DefaultCredentials;
            wc.UseDefaultCredentials = true;
            wc.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
            string downloadUrl = SPContext.Current.Site.Url + i.Key;
            Uri uri = new Uri(downloadUrl);
            AppClass.WriteToLog(string.Format("downloadUrl: {0}\nUri.AbsoluteUri: {1}", downloadUrl, uri.AbsoluteUri));
            byte[] img = wc.DownloadData(uri.AbsoluteUri);
  
            if (!wc.ResponseHeaders.Get(0).Contains("OK"))
            {
                 AppClass.WriteToLog("Unable to donwload the file");
            }
            zip.AddEntry(i.Value, img);
        }
  
        zip.Save(Response.OutputStream);
  }
  </code></pre>
  
  <p>And now I have another problem. <code>The remote server returned an error: (403) Forbidden</code></p>