Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets the global HTTP proxy.
public:
static property System::Net::IWebProxy ^ DefaultProxy { System::Net::IWebProxy ^ get(); void set(System::Net::IWebProxy ^ value); };
public static System.Net.IWebProxy DefaultProxy { get; set; }
static member DefaultProxy : System.Net.IWebProxy with get, set
Public Shared Property DefaultProxy As IWebProxy
A proxy used by every HTTP request.
The value passed cannot be null
.
This static property determines the default proxy that all HttpClient instances use if no proxy is set explicitly in the HttpMessageHandler passed through its constructor.
The default instance returned by this property will initialize following a different set of rules depending on your platform:
For Windows: Reads proxy configuration from environment variables or, if those are not defined, from the user's proxy settings.
For macOS: Reads proxy configuration from environment variables or, if those are not defined, from the system's proxy settings.
For Linux: Reads proxy configuration from environment variables or, in case those are not defined, this property initializes a non-configured instance that bypasses all addresses.
The environment variables used for DefaultProxy
initialization on Windows and Unix-based platforms are:
NO_PROXY=.example.com
(with leading dot) will match www.example.com
, but will not match example.com
. NO_PROXY=example.com
(without leading dot) will not match www.example.com
. This behavior might be revisited in the future to match other ecosystems better.On systems where environment variables are case-sensitive, the variable names may be all lowercase or all uppercase. The lowercase names are checked first.
The proxy server may be a hostname or IP address, optionally followed by a colon and port number, or it may be an http
, https
, socks4
, socks4a
, or socks5
URL. The URL cannot include any text after the hostname, IP, or port. If a scheme isn't specified, http
is assumed.
The URL may optionally include a username and password for proxy authentication, but the password is ignored when using socks4
or socks4a
as the protocols have no support for password authentication.
http
: http://[username:password@]hostname[:port]
https
: https://[username:password@]hostname[:port]
socks4
: socks4://[username@]hostname[:port]
socks4a
: socks4a://[username@]hostname[:port]
socks5
: socks5://[username:password@]hostname[:port]
Product | Versions |
---|---|
.NET | Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in