Export (0) Print
Expand All

Proxy Configuration

A proxy server handles client requests for resources. A proxy can return a requested resource from its cache or forward the request to the server where the resource resides. Proxies can improve network performance by reducing the number of requests sent to remote servers. Proxies can also be used to restrict access to resources.

In the .NET Framework, proxies come in two varieties: adaptive and static. Adaptive proxies adjust their settings when the network configuration changes. For example, if a laptop user starts a dialup network connection, an adaptive proxy would recognize this change, discover and run its new configuration script, and adjust its settings appropriately.

Adaptive proxies are configured by a configuration script (see Automatic Proxy Detection). The script generates a set of application protocols and a proxy for each protocol.

Options control how the configuration script is run. You can specify the following:

  • How long to wait for the script to download.

  • Which credentials your system should use to access the proxy.

Changes in the network environment may require that the system use a new set of proxies. If a network connection goes down or a new network connection is initialized, the system must discover the appropriate source of the configuration script in the new environment and run the new script.

The following table shows configuration options for an adaptive proxy.

Element, Attribute, property, or configuration file setting

Description

downloadTime attribute on the <webProxyScript> element.

Time to wait for the web proxy script to download.

useDefaultCredentials attribute on the <defaultProxy> element or the UseDefaultCredentials property.

Controls whether the default credentials for this host are used to access the web proxy. The default value is false.

usesystemdefault attribute on the <proxy> element.

Controls whether the static proxy settings (proxy address, bypass list, and bypass on local) should be read from the Internet Explorer proxy settings for the user. If this value is set to "true", then the static proxy settings from Internet Explorer will be used.

If this value is "false" or not set, then the static proxy settings can be specified in the configuration and will override the Internet Explorer proxy settings. This value must also be set to "false" or not set for adaptive proxies to be enabled.

The following example shows a typical adaptive proxy configuration.

<system.net>
    <defaultProxy>
      <proxy  useDefaultCredentials="true"
              usesystemdefaults="true"
      />
    </defaultProxy>
    <settings>
        <webProxyScript downloadTime="00:00:30" />
    </settings>
<system.net>

Static proxies are usually configured explicitly by an application, or when a configuration file is invoked by an application or the system. Static proxies are useful in networks in which the topology changes infrequently, such as a desktop computer connected to a corporate network.

Several options control how a static proxy operates. You can specify the following:

  • The address of the proxy.

  • Whether the proxy should be bypassed for local addresses.

  • Whether the proxy should be bypassed for a set of addresses.

The following table shows the configuration options for a static proxy.

Attribute, property, or configuration file setting

Description

proxyaddress attribute on the <proxy> element or the Address property.

The address of the proxy to use.

bypassonlocal attribute on the <proxy> element, or the BypassProxyOnLocal property.

Controls whether the proxy is bypassed for local addresses.

<bypasslist> element or the BypassArrayList property.

Describes, with regular expressions, a set of addresses that bypass the proxy.

usesystemdefault attribute on the <proxy> element.

Controls whether the static proxy settings (proxy address, bypass list, and bypass on local) should be read from the Internet Explorer proxy settings for the user. If this value is set to "true", then the static proxy settings from Internet Explorer will be used. On .NET Framework 2.0 when this value is set to "true", the Internet Explorer proxy settings are not overridden by other proxy settings in the configuration file. On .NET Framework 1.1, the Internet Explorer proxy settings can be overridden by other proxy settings in the configuration file.

If this value is "false" or not set, then the static proxy settings can be specified in the configuration and will override the Internet Explorer proxy settings. This value must also be set to "false" or not set for adaptive proxies to be enabled.

The following example shows a typical static proxy configuration.

<system.net>
    <defaultProxy>
        <proxy  proxyaddress="http://proxy.contoso.com:3128"
                bypassonlocal="true"
        />
        <bypasslist>
            <add address="[a-z]+.blueyonderairlines.com$" />
        </bypasslist>
    </defaultProxy>
<system.net>

Community Additions

ADD
Show:
© 2014 Microsoft