webRequestModules 的 <clear> 元素(网络设置)

从应用程序中删除所有已注册的 Web 请求模块。

configuration
  <system.net>
    <webRequestModules>
      <clear>

语法

<clear/>  

特性和元素

下列各节描述了特性、子元素和父元素。

特性

无。

子元素

无。

父元素

元素 说明
webRequestModules 指定用于从网络主机请求信息的模块。

注解

clear 元素用于删除之前在配置文件或配置层次结构的较高级别中定义的所有已注册的 Web 请求模块。

配置文件

此元素可在应用程序配置文件或计算机配置文件 (Machine.config) 中使用。

示例

以下示例会清除所有 Web 请求模块,然后注册 HTTP 的 Web 请求模块。

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

另请参阅