//This method will return the XMLdocument fetched from the provided URL public XmlDocument GetXmlFromUrl(string url) { //requesting the URL var httpRequest = (HttpWebRequest)WebRequest.Create(url); //response from the request url is fetched var response = (HttpWebResponse)httpRequest.GetResponse(); //Store the contents of the response in the stream(there are also other options) var receivedDataStream = response.GetResponseStream(); //New XMLdocument var xmlFetchedData = new XmlDocument(); //load the file from the stream xmlFetchedData.Load(receivedDataStream); //close the stream receivedDataStream.Close(); return xmlFetchedData; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)