Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,
I have a asp.net web application in 3.5 .net framework.
Some XML data is posted to a url in our web application.
How to read those xml data from url?

Thanks in advance,
George n t .
Posted

 
Share this answer
 
Try these links. The first one is a good one.
Parse an XML file[^]
Implementing XML RPC services[^]
 
Share this answer
 
C#
//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;
}


Note : You will have to include necessary libraries

For further reading : http://support.microsoft.com/kb/307643[^]

http://nishantwork.wordpress.com/2012/10/10/how-to-get-xml-data-from-url-in-c/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900