Programming Pluggable Protocols
The abstract WebRequest and WebResponse classes provide the base for pluggable protocols. By deriving protocol-specific classes from WebRequest and WebResponse, an application can request data from an Internet resource and read the response without specifying the protocol being used.
Before you can create a protocol-specific WebRequest, you must register its Create method. Use the static RegisterPrefix(String, IWebRequestCreate) method of WebRequest to register a WebRequest descendant to handle a set of requests to a particular Internet scheme, to a scheme and server, or to a scheme, server, and path.
In most cases you will be able to send and receive data using the methods and properties of the WebRequest class. However, if you need to access protocol-specific properties, you can typecast a WebRequest to a specific derived-class instance.
To take advantage of pluggable protocols, your WebRequest descendants must provide a default request-and-response transaction that does not require protocol-specific properties to be set. For example, the HttpWebRequest class, which implements the WebRequest class for HTTP, provides a GET request by default and returns an HttpWebResponse that contains the stream returned from the Web server.
参照
処理手順
How to: Typecast a WebRequest to Access Protocol Specific Properties