0

How can i get the web representation of a received http-request?
I recently asked a question on how i could circumvetnt a website censorship through a third anonymizer website.the result indicated i sniff the traffic and create the post url myself.
This stage is almost done.Now i need to get the page as a result.

cuongle
  • 74,024
  • 28
  • 151
  • 206
Hossein
  • 24,202
  • 35
  • 119
  • 224

1 Answers1

1

If you're using Winforms, you could go with the WebBrowser class.

The WebBrowser control lets you host Web pages and other browser-enabled documents in your Windows Forms applications. You can use the WebBrowser control, for example, to provide integrated HTML-based user assistance or Web browsing capabilities in your application. Additionally, you can use the WebBrowser control to add your existing Web-based controls to your Windows Forms client applications.

(From MSDN)


You wish to save the response to disk. Ok, typically this is the sequence you'd take:

  1. You make the HTTP request using the HttpWebRequest class.
  2. Get the response using the GetResponse method. This will return an HttpWebResponse object.
  3. Call GetResponseStream on that response object, and then
  4. Write that stream to a file.

<sidenote> You should try and be a bit more clear in your question. I interpret the "web representation" of an HTTP request to be a "web page", as displayed in a browser. You never mentioned that you wanted to save the reply to disk.

Community
  • 1
  • 1
Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
  • Thanks,I dont plan on showing it on the form,Is it still useable for me? – Hossein Oct 11 '12 at 04:32
  • 1
    @Hossein, What do you plan on doing then? You make an HTTP request, you receive an HTTP response. The body of the response *is* the HTML you requested. That HTML is to be interpreted by a web browser. If you don't plan on parsing the code, or showing it in a browser, I don't know what you're trying to accomplish. – Jonathon Reinhart Oct 11 '12 at 04:35