<defaultProxy> element (network settings)

Configures the Hypertext Transfer Protocol (HTTP) proxy server.

<configuration>   <system.net>     <defaultProxy>


If you're migrating to .NET 6+, configure the proxy server using the HttpClient.DefaultProxy property.



Attributes and elements

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


Element Description
enabled Specifies whether a web proxy is used. The default value is True.
useDefaultCredentials Specifies whether the default credentials for this host are used to access the web proxy. The default value is False.

Child elements

Element Description
bypasslist Provides a set of regular expressions that describe addresses that do not use the proxy.
module Adds a new proxy module to the application.
proxy Defines a proxy server.

Parent elements

Element Description
system.net Contains settings that specify how .NET Framework connects to the network.


If the defaultProxy element is empty, the system proxy settings are used.

An exception is thrown if the module element specifies a non-public type, the type is not deriving from the IWebProxy class, an exception from the parameterless constructor of this object occurred, or an exception occurred while retrieving the system-specified 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 and contoso.com.

        <add address="[a-z]+\.contoso\.com$" />

See also