Re: HttpRequest Question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Latish,

The code that Patrice provided seems to be doing the same thing. I've uploaded a test page for you guys to look at. Here is the link. also included below is the code for that page. It's not terribly complex. What I believe to be happening is that the HttpWebRequest Object is parsing the XML much like a browser would. I don't believe that that translated result is what the server is delivering.

If you browse out to the link that the code is requesting and "view source" you'll see the raw xml, however if you look at what my code is outputting you can see that you get the transformed document instead.

Here is the link to my page.
http://armory.bobguild.net/default.aspx

Here is the link that the page is trying to request.
http://armory.worldofwarcraft.com/guild-info.xml?r=Duskwood&n=Band+%C3%B2f+Brothers&p=1

Here is the codebehind my page.
string URL = "http://armory.worldofwarcraft.com/guild-info.xml?r=Duskwood&n=Band+%C3%B2f+Brothers&p=1";;
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);

//Get the data as an HttpWebResponse object
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

//Convert the data into a string (assumes that you are requesting text)
StreamReader sr = new StreamReader(resp.GetResponseStream());

String results = sr.ReadToEnd();
sr.Close();

Response.Write(results);

Thanks!

Anthony Sullivan

"Latish Sehgal" <latish.sehgal@xxxxxxxxx> wrote in message news:1175138486.902893.39580@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Anthony
Could you give a sample page where you are able to see the xml source?
I tried the code with the url Patrice cited above, and it seems to
work.

string URL = "http://msdn.microsoft.com/globalrss/en-us/global-
msdn-en-us.xml";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(URL);


//Get the data as an HttpWebResponse object
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

//Convert the data into a string (assumes that you are
requesting text)
StreamReader sr = new StreamReader(resp.GetResponseStream());

String results = sr.ReadToEnd();
sr.Close();


.



Relevant Pages

  • Re: TrueCrypt & user Rights
    ... He'll be requesting subject to optimistic Dickie until his string ... We exchange the superb rose. ...
    (sci.crypt)
  • Re: FileUpload
    ... Mich interessier eigentlich nur ob man das was im Beispielcode mit der ... HttpWebRequest Klasse gemacht wird auch mit WebClient.UploadFile möglich ist. ... private bool UploadFileWithPost(string filename, string issueID) ... WebClient webClient = new WebClient; ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: FileUpload
    ... Mich interessier eigentlich nur ob man das was im Beispielcode mit der ... HttpWebRequest Klasse gemacht wird auch mit WebClient.UploadFile möglich ... private bool UploadFileWithPost(string filename, string issueID) ...
    (microsoft.public.de.german.entwickler.dotnet.csharp)
  • Re: Modify exchange security descriptor
    ... You could use the security module in the SDK. ... > HttpWebRequest request = WebRequest.Create; ... > HttpWebResponse response = request.GetResponse; ... > string strStatus = response.StatusCode.ToString; ...
    (microsoft.public.exchange2000.development)
  • Re: byte array problem
    ... the HttpWebRequest to send the XML data via HTTP POST? ... but it becomes a string at the other end. ... HttpWebRequest IoHttp = WebRequest.Create; ... > To receive the byte array from the client should I be using ...
    (microsoft.public.dotnet.framework.aspnet)