title: WebClient.DownloadFile vs. WebClient.DownloadData
body: <p>I am using <code>WebClient.DownloadFile</code> to download a small executable file from the internet. This method is working very well. However, I would now like to download this executable file into a byte array rather than onto my hard drive. I did some reading and came across the <code>WebClient.DownloadData</code> method. The problem that I am having with the downloadData method is that rather than downloading my <em>file</em>, my code is downloading the HTML data behind my file's download page.</p>
  
  <p>I have tried using dozens of sites - each brings me the same issue. Below is the code I am using.</p>
  
  <pre><code>// Create a new instance of the System.Net 'WebClient'
          System.Net.WebClient client = new System.Net.WebClient();
  
          // Download URL
          Uri uri = new Uri("http://www35.multiupload.com:81/files/4D7B4D2BFC3F1A9F765A433BA32ED2C5883D0CE133154A0FDB7E7786547A3165DA62393141C4AF8FF36C75222566CF3EB64AF6FBCFC02099BB209C891529CF7B90C83D9C63D39D989CBB8ECE6DE2B83B/Project1.exe");
  
          byte[] dbytes = client.DownloadData(uri);
  
          MessageBox.Show(dbytes.Length.ToString()); // Not the size of my file
  </code></pre>
  
  <p>Keep in mind that I am attempting to download the data of an executable file into a byte array.</p>
  
  <p>Thank you for any help,
  Evan</p>