Re: HttpRequest Question
- From: "Patrice" <http://www.chez.com/scribe/>
- Date: Wed, 28 Mar 2007 17:45:36 +0200
Just to confirm the behavior I assumed. That is when reading an XML document
such as http://msdn.microsoft.com/globalrss/en-us/global-msdn-en-us.xml, I
still get the unchanged XML document.
So :
- either you mistakenly thought the document was transformed because you saw
it in a browser(in which case it shouldn't be a problem)
- either the server could render an already transformed document if the user
agent is thought to be unaware of XML/XSL (in which case you could try to
provide the missing user agent information).
---
Patrice
"Patrice" <http://www.chez.com/scribe/> a écrit dans le message de news:
e55fuwUcHHA.4976@xxxxxxxxxxxxxxxxxxxxxxx
Do yo meant you used "view source" and you see transformed content ? Else
you'll have to suppress the style*** line. For now IMO you should get
the XML document but as you have still the style*** reference embedded
in it, the browser to which you stream the result will still use the
style***.
Else I'll give this a try but I doubt WebRequest would automatically
handle this. Another option could be that the server itself does something
based for example on the user agent to render already transformed data if
it looks like the user agent doesn't support stylesheets...
"Anthony Sullivan" <anthony@xxxxxxxxxxxxxxxxxxx> a écrit dans le message
de news: EDCEFD6F-1443-412D-82CC-587CBA82FF63@xxxxxxxxxxxxxxxx
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
style*** 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
.
- Follow-Ups:
- Re: HttpRequest Question
- From: Anthony Sullivan
- Re: HttpRequest Question
- References:
- HttpRequest Question
- From: Anthony Sullivan
- Re: HttpRequest Question
- From: Patrice
- HttpRequest Question
- Prev by Date: Re: IIS Virtual Directory on-the-fly
- Next by Date: using radio button option in a repeater control
- Previous by thread: Re: HttpRequest Question
- Next by thread: Re: HttpRequest Question
- Index(es):