Programming Pluggable Protocols
This page is specific to:.NET Framework Version:1.12.03.03.54.0
.NET Framework Developer's Guide
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.

See Also

Tasks

Concepts

Other Resources

© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View