The abstract WebRequest and WebResponse classes provide the base for the 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 needing to be aware of the specific protocol used.
Before a WebRequest instance can be created, its Create method must be registered with the WebRequestFactory. You use the Register method of the WebRequestFactory to register a WebRequest descendent to handle a set of requests to a particular Internet scheme.
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:
HttpWebRequest httpreq = (HttpWebRequest) WebRequestFactory.Create("http://www.microsoft.com/");