Sdílet prostřednictvím


<remove> Element for webRequestModules (Network Settings)

Removes a custom Web request module from the application.

<configuration> Element
  <system.Net> Element (Network Settings)
    <webRequestModules> Element (Network Settings)
      <remove> Element for webRequestModules (Network Settings)

<remove 
  name = "URI prefix" 
/>

Attributes and Elements

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

Attributes

Attribute

Description

name

The URI prefix for requests handled by this Web request module.

Child Elements

None.

Parent Elements

Element

Description

webRequestModules

Specifies modules to use to request information from network hosts.

Remarks

The remove element removes the registered Web request module for the specified URI prefix.

The value for the prefix attribute should be the leading characters of a valid URI -- for example, "http", or "https://www.contoso.com".

Configuration Files

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

Example

The following code example removes the existing Web request module for HTTP and then registers a new custom Web request module for HTTP requests to www.contoso.com.

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

See Also

Reference

Network Settings Schema

WebRequest