# <proxy> Element (Network Settings)

Defines a proxy server.

## Syntax

<proxy
autoDetect="true|false|unspecified"
bypassonlocal="true|false|unspecified"
scriptLocation="uriString"
usesystemdefault="true|false|unspecified"
/>


## Attributes and Elements

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

### Attributes

Attribute Description
autoDetect Specifies whether the proxy is automatically detected. The default value is unspecified.
bypassonlocal Specifies whether the proxy is bypassed for local resources. Local resources include the local server (http://localhost, http://loopback, or http://127.0.0.1) and a URI without a period (http://webserver). The default value is unspecified.
proxyaddress Specifies the proxy URI to use.
scriptLocation Specifies the location of the configuration script. Do not use the bypassonlocal attribute with this attribute.
usesystemdefault Specifies whether to use Internet Explorer proxy settings. If set to true, subsequent attributes will override Internet Explorer proxy settings. The default value is unspecified.

None.

### Parent Elements

Element Description
defaultProxy Configures the Hypertext Transfer Protocol (HTTP) proxy server.

## Remarks

The proxy element defines a proxy server for an application. If this element is missing from the configuration file, then the .NET Framework will use the proxy settings in Internet Explorer.

The value for the proxyaddress attribute should be a well-formed Uniform Resource Indicator (URI).

The scriptLocation attribute refers to the automatic detection of proxy configuration scripts. The WebProxy class will attempt to locate a configuration script (usually named Wpad.dat) when the Use automatic configuration script option is selected in Internet Explorer. If bypassonlocal is set to any value, scriptLocation is ignored.

Use the usesystemdefault attribute for .NET Framework version 1.1 applications that are migrating to version 2.0.

An exception is thrown if the proxyaddress attribute specifies an invalid default proxy. The InnerException property on the exception should have more information about the root cause of the error.

## Configuration Files

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

## Example

The following example uses the defaults from the Internet Explorer proxy, specifies the proxy address, and bypasses the proxy for local access.

<configuration>
<system.net>
<defaultProxy>
<proxy
usesystemdefault="true"