Share via


<webRequestModules> Element

Specifies modules to use to request information from Internet hosts.

<configuration>
   <system.net>
      <webRequestModules>

<webRequestModules>
</webRequestModules>

Child Elements

Element Description
<add> Adds a custom Web request module to the application.
<clear> Removes all registered Web request modules.
<remove> Removes the specified Web request module.

Remarks

The <webRequestModules> element registers descendants of the WebRequest class to handle information requests to Internet hosts. Web request modules must implement the IWebRequestCreate interface.

The .NET Framework includes Web request modules for URIs that begin with http://, https://, and file://. You can override the default modules only by registering a custom module in the configuration file.

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 | IWebRequestCreate | <add> Element for <webRequestModules> | Network Settings Schema