This documentation is archived and is not being maintained.

Creating Internet Requests

Applications create WebRequest instances through the WebRequest.Create method. This is a static method that creates a descendant WebRequest based on the URI scheme passed to it.

The .NET Framework provides an HttpWebRequest class, which descends from WebRequest, to handle HTTP and HTTPS requests to the Internet. In most cases, WebRequest provides all the properties you need to make a request; however, if necessary, you can typecast WebRequest objects created by the WebRequest.Create method to HttpWebRequest to access the HTTP-specific properties of the request.

The HttpWebResponse handles the responses from HTTP and HTTPS requests to the Internet. To access the HTTP-specific properties of HttpWebResponse, you need to typecast WebResponse to HttpWebResponse.

To handle requests that use other Internet protocols, such as FTP, you need to derive protocol-specific descendants of WebRequest and WebResponse. For more information, see Programming Pluggable Protocols.

See Also

Using Internet Request and Response Classes | Requesting Data