Export (0) Print
Expand All

WebProxy.BypassProxyOnLocal Property

Gets or sets a value that indicates whether to bypass the proxy server for local addresses.

Namespace:  System.Net
Assembly:  System (in System.dll)

public bool BypassProxyOnLocal { get; set; }

Property Value

Type: System.Boolean
true to bypass the proxy server for local addresses; otherwise, false. The default value is false.

The setting of the BypassProxyOnLocal property determines whether WebRequest instances use the proxy server when accessing local Internet resources.

If BypassProxyOnLocal is true, requests to local Internet resources do not use the proxy server. Local requests are identified by the lack of a period (.) in the URI, as in http://webserver/, or access the local server, including http://localhost, http://loopback, or http://127.0.0.1. When BypassProxyOnLocal is false, all Internet requests are made through the proxy server.

NoteNote

Requests to a local host with a URI that contain a period use the proxy. To avoid using a proxy in these cases, create an entry for the host in the BypassList.

The following code example demonstrates calling a constructor that sets this property and getting the value of this property.

public static WebProxy CreateProxyWithHostAddress(bool bypassLocal)
{
    WebProxy proxy =  new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}", 
       proxy.BypassProxyOnLocal);
    return proxy;
}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft