From within my .aspx page I am trying to make a request to an xml page that is on the web and return the value of one of the nodes. The page in question will be a service that accepts a query string and outputs the results to my own aspx page.
For learning purposes though I am just trying to make a simple example. I have found this page: http://www.w3schools.com/xml/note.xml What I would like to do is have a button that when clicked will display to a textbox the value of the < body>< /body> node?
I have been trying to do it with the WebClient Class but I’m not positive if this is the correct way to go about it. I have been following this example http://www.codeproject.com/script/Articles/ViewDownloads.aspx?aid=33798 but I am encountering exception (407) Proxy Authentication Required.
You could use LINQ to XML like so to load the XML and retrieve the elements you wish:
Using your example (http://www.w3schools.com/xml/note.xml), the above would output the following:
Hope this helps.
Edit (Based on comment)
If you are sitting behind a proxy server and have default credentials setup you can try the following (untested as not behind proxy):
Note
(From MSDN WebRequest.DefaultWebProxy Property)