A
Anthony Sullivan
I'm working on a quick and dirty little app that will go out to a website
and scrape an xml response.
So far its working fine with one exception. The xml response has an xsl
stylesheet tag at the top so that when a browser hits it the xml is
transformed. When I use the code below I get the transformed version of the
page rather than the raw xml. Can anyone tell me how to get the raw xml
response that I see when I 'view source' in IE?
Here is the code:
HttpWebRequest oRequest = (HttpWebRequest)
WebRequest.Create("Http://www.randomwebsite.com/somexmlfile.xml");
HttpWebResponse oResponse = (HttpWebResponse)
oRequest.GetResponse();
Stream oStream = oResponse.GetResponseStream();
StreamReader oReader = new StreamReader(oStream);
Response.Write(oReader.ReadToEnd());
oResponse.Close();
Thanks!
Anthony
and scrape an xml response.
So far its working fine with one exception. The xml response has an xsl
stylesheet tag at the top so that when a browser hits it the xml is
transformed. When I use the code below I get the transformed version of the
page rather than the raw xml. Can anyone tell me how to get the raw xml
response that I see when I 'view source' in IE?
Here is the code:
HttpWebRequest oRequest = (HttpWebRequest)
WebRequest.Create("Http://www.randomwebsite.com/somexmlfile.xml");
HttpWebResponse oResponse = (HttpWebResponse)
oRequest.GetResponse();
Stream oStream = oResponse.GetResponseStream();
StreamReader oReader = new StreamReader(oStream);
Response.Write(oReader.ReadToEnd());
oResponse.Close();
Thanks!
Anthony