Re: HttpRequest Question
- From: "Anthony Sullivan" <anthony@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 08:44:58 -0400
See my response to Latish Seghal further down the thread.
Thanks!
"Patrice" <http://www.chez.com/scribe/> wrote in message news:%23diYkLdcHHA.596@xxxxxxxxxxxxxxxxxxxxxxx
IMO it left us with the second option I talked about in a previous post as you are positively sure you get a transformed document from the server. That is if the server receives a request without a user agent string it could then perform the transformation server side to support non XML/XSL browsers.
Have you tried my suggestion to add a valid user agent string to your request ?
---
Patrice
"Anthony Sullivan" <anthony@xxxxxxxxxxxxxxxxxxx> a écrit dans le message de news: 0766C118-CEA4-4F31-8355-E8966E3209AE@xxxxxxxxxxxxxxxxI'm sorry,
I'm probably not being completely clear.
When I hit view source I see XML. However, If use the code I posted in my original post and I save the response stream to a file it isn't the XML but rather the transformed HTML. Even if I open it in notpade which removes the browser element from the equation.
I wish I knwe a way to be more transparent but I don't.
Anthony
"Patrice" <http://www.chez.com/scribe/> wrote in message news:ej0oiAVcHHA.4308@xxxxxxxxxxxxxxxxxxxxxxxJust 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@xxxxxxxxxxxxxxxxxxxxxxxDo 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@xxxxxxxxxxxxxxxxI'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: Latish Sehgal
- Re: HttpRequest Question
- References:
- HttpRequest Question
- From: Anthony Sullivan
- Re: HttpRequest Question
- From: Patrice
- Re: HttpRequest Question
- From: Patrice
- Re: HttpRequest Question
- From: Anthony Sullivan
- Re: HttpRequest Question
- From: Patrice
- HttpRequest Question
- Prev by Date: Re: HttpRequest Question
- Next by Date: Re: Internal Applications app
- Previous by thread: Re: HttpRequest Question
- Next by thread: Re: HttpRequest Question
- Index(es):