• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 495
  • Last Modified:

The fastest way to read a remote XML file

Hi,

What would be the fastest and most efficient way to read a remote XML file (http://...) from my C# desktop application.

Please advise.
0
EEssam
Asked:
EEssam
1 Solution
 
Göran AnderssonCommented:
You can use the WebClient class:

string address = "http://www.somedomain.com/somefile.xml";
System.Net.WebClient client = new System.Net.WebClient ();
string reply = client.DownloadString (address);

You can use the DownloadStringAsync method instead, if you don't want the call to wait for the file to download. That way your program will not be unresponsive while the file is downloaded. The DownloadStringCompleted event will be triggered when the download is complete.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now