title: Automatically download an xml file from URI with download popup
body: <p>ASP.NET MVC 4 Razor:</p>
  
  <p>I've been working at this for a bit, so I apologize if I'm missing something obvious, but I will truly appreciate any assistance that could be offered.  </p>
  
  <p>In a nutshell, what I'm looking to do is download an XML file from a URI using C#.  It ought to be pretty straightforward, but the URI leads to a blank page with a download prompt popup populated with a dynamically created filename.  </p>
  
  <p>I can't provide the URI due to its confidential nature, but here is the code I've been toying with. (Forgive my ignorance on this matter, it's the first time I've tried anything like this)</p>
  
  <pre><code>byte[] data;
  using (WebClient Client = new WebClient())
  {
      data = Client.DownloadData(uriString + fileString);
  }
  File.WriteAllBytes(dirString + fileString, data);
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>using (WebClient Client = new WebClient())
  {
      Client.DownloadFile(uriString + fileString, dirString + fileString);
  }
  </code></pre>
  
  <p>To be honest, this code doesn't really work for me.  The downloaded files aren't correct.  The XML files appear to contain the code from the webpage they've been downloaded from, and if I try something like an image, the image is broken.  So, again, any assistance would be appreciated.</p>
  
  <p>Thanks in advance!</p>