Share via


<bypasslist> Element (Network Settings)

Provides a set of regular expressions that describe addresses that do not use a proxy.

<configuration> Element
  <system.net> Element (Network Settings)
    <defaultProxy> Element (Network Settings)
      <bypasslist> Element (Network Settings)

<bypasslist> 
</bypasslist>

Attributes and Elements

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

Attributes

None.

Child Elements

Element

Description

<add>

Adds an IP address or DNS name to the proxy bypass list.

<clear>

Clears the bypass list.

<remove>

Removes an IP address or DNS name from the proxy bypass list.

Parent Elements

Element

Description

<defaultProxy>

Configures the Hypertext Transfer Protocol (HTTP) proxy server.

Remarks

The bypass list contains regular expressions that describe URIs that WebRequest instances access directly instead of through the proxy server.

You should use caution when specifying a regular expression for this element. The regular expression "[a-z]+\.contoso\.com" matches any host in the contoso.com domain, but it also matches any host in the contoso.com.cpandl.com domain. To match only a host in the contoso.com domain, use an anchor ("$"): "[a-z]+\.contoso\.com$".

For more information about regular expressions, see ..NET Framework Regular Expressions.

Configuration Files

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

Example

The following code example adds two addresses to the bypass list. The first bypasses the proxy for all servers in the contoso.com domain; the second bypasses the proxy for all servers whose IP addresses begin with 192.168.

<configuration>
  <system.net>
    <defaultProxy>
      <bypasslist>
        <add address="[a-z]+\.contoso\.com$" />
        <add address="192\.168\.\d{1,3}\.\d{1,3}" />
      </bypasslist>
    </defaultProxy>
  </system.net>
</configuration>

See Also

Reference

Network Settings Schema

System.Net.WebProxy