<webRequestModules> Element (Network Settings)

Specifies modules to use to request information from network hosts.

<configuration>
  <system.net>
    <webRequestModules>

Syntax

<webRequestModules>
</webRequestModules>  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.

Attributes

None.

Child Elements

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

Parent Elements

Element Description
system.net Contains settings that specify how the .NET Framework connects to the network.

Remarks

The webRequestModules element registers descendants of the WebRequest class to handle information requests to network 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.

Configuration Files

This element can be used in the application configuration file or the machine configuration file (Machine.config).

Example

The following example registers the default HTTP module. You should replace the values for Version and PublicKeyToken with the correct values for the specified module.

<configuration>  
  <system.net>  
    <webRequestModules>  
      <add prefix="http"  
           type="System.Net.HttpRequestCreator, System, Version=2.0.3600.0,  
           Culture=neutral, PublicKeyToken=b77a5c561934e089"  
      />  
    </webRequestModules>  
  </system.net>  
</configuration>  

See also