ASP.NET MVC 4 Razor:
I have worked a bit on this, so I apologize if I am missing something obvious, but I will really appreciate any help that might be offered.
In short, what I want to do is load an XML file from a URI using C #. This should be pretty simple, but the URI leads to a blank page with a popup loading window populated with a dynamically generated file name.
I cannot provide a URI because of its confidential nature, but here is the code I played with. (Forgive my ignorance in this matter, this is the first time I've tried something like this)
byte[] data; using (WebClient Client = new WebClient()) { data = Client.DownloadData(uriString + fileString); } File.WriteAllBytes(dirString + fileString, data);
I also tried:
using (WebClient Client = new WebClient()) { Client.DownloadFile(uriString + fileString, dirString + fileString); }
Honestly, this code really doesn't work for me. The downloaded files are incorrect. The XML files seem to contain code from the web page from which they were downloaded, and if I try something like an image, the image will be broken. So, again, any help would be appreciated.
Thanks in advance!
source share