<proxy> Element (Network Settings)

Defines a proxy server.




Attributes and Elements

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


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 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 system proxy settings. If set to True, subsequent attributes will override system proxy settings. The default value is Unspecified.

Child Elements


Parent Elements

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

Text Value


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

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 for the connection in Internet properties. If bypassonlocal is set to any value, scriptLocation is ignored.

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).


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


See also