
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
802
|
Chapter 14: Web
You generate the HttpWebRequest, send it and get the HttpWebResponse, then check the
success using the
VerifyResponse method from Recipe 14.5.
Discussion
The WebRequest and WebResponse classes encapsulate all of the functionality to per-
form basic web communications.
HttpWebRequest and HttpWebResponse are derived
from these classes and provide the HTTP-specific support.
At the most fundamental level, to perform an HTTP-based web transaction, you use
the
Create method on the WebRequest class to get a WebRequest that can be cast to an
HttpWebRequest (so long as the scheme is http:// or https://). This HttpWebRequest is
then submitted to the web server in question when the GetResponse method is called,
and it returns an
HttpWebResponse that can then be inspected for the response data.
See Also
See the “WebRequest Class,” “WebResponse Class,” “HttpWebRequest Class,” and
“HttpWebResponse Class” topics in the MSDN documentation.
14.7 Going Through a Proxy
Problem
Many companies have a web proxy that allows employees to access the Internet,
while at the same time preventing outsiders from accessing the company’s internal
network. The problem is that to create an application that accesses the Internet from
within your company, you must first connect to your proxy and then send