<add> Element for <webRequestModules>
Adds a custom Web request module to the application.
<configuration>
<system.net>
<webRequestModules>
<add>
<add
prefix = "protocol prefix"
type = "Assembly, Class"
/>
Required Attributes
Attribute | Description |
---|---|
prefix | The URI prefix for requests handled by this Web request module. |
type | The assembly and class name of the module that implements this Web request module. |
Remarks
The prefix attribute defines the URI prefix that uses the specified Web request module. Web request modules are typically registered to handle a specific protocol, such as HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.
The Web request module is created when a URI matching prefix is passed to the WebRequest.Create method.
Example
The following example registers a custom Web request module for HTTP.
<configuration>
<system.net>
<webRequestModules>
<add prefix="http" type="MyHttpModule.dll, MyHttpModule" />
</webRequestModules>
</system.net>
</configuration>
Configuration File
This element can be used in the application configuration file, the machine configuration file (Machine.config), and the publisher policy file.
See Also
WebRequest | webRequestModules Element | Network Settings Schema