Creating Internet Requests
Applications create WebRequest instances through the WebRequest.Create method. This is a static method that creates a class derived from WebRequest based on the URI scheme passed to it.
Web, File and FTP Requests
The .NET Framework provides the HttpWebRequest class, which is derived from WebRequest, to handle HTTP and HTTPS requests. In most cases, the WebRequest class provides all the properties you need to make a request; however, if necessary, you can cast WebRequest objects created by the WebRequest.Create method to the HttpWebRequest type to access the HTTP-specific properties of the request. Similarly, the HttpWebResponse object handles the responses from HTTP and HTTPS requests. To access the HTTP-specific properties of the HttpWebResponse object, you need to cast WebResponse objects to the HttpWebResponse type.
The .NET Framework also provides the FileWebRequest and FileWebResponse classes to handle requests for resources that use the "file:" URI scheme. Likewise, the FtpWebRequest and FtpWebResponse classes are provided to handle requests for resources that use the "ftp:" scheme. If your request is for a resource that uses any of these schemes, you can use the WebRequest.Create method to obtain an object with which to make your request.
To handle requests that use other application-level protocols, you need to implement protocol-specific classes derived from WebRequest and WebResponse. For more information, see Programming Pluggable Protocols.
См. также
Задачи
How to: Request Data Using the WebRequest Class