This documentation is archived and is not being maintained.

WebProxy.IsBypassed Method

Indicates whether to use the proxy server for the specified host.

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

Public Function IsBypassed ( _
	host As Uri _
) As Boolean


Type: System.Uri
The Uri instance of the host to check for proxy use.

Return Value

Type: System.Boolean
true if the proxy server should not be used for host; otherwise, false.




The host parameter is Nothing.

The IsBypassed method is used to determine whether to bypass the proxy server when accessing an Internet resource.

The BypassProxyOnLocal and BypassList properties control the return value of the IsBypassed method.

IsBypassed returns true under any of the following conditions:

  • If BypassProxyOnLocal is true and host is a local URI. Local requests are identified by the lack of a period (.) in the URI, as in "http://webserver/".

  • If host matches a regular expression in BypassList.

  • If Address is Nothing.

All other conditions return false.

The following code example creates a WebProxy object and calls this method to check whether the bypass list is properly set.

Public Shared Function CreateProxyAndCheckBypass(ByVal bypassLocal As Boolean) As WebProxy
    ' Do not use the proxy server for URIs.
    Dim bypassList() As String = {";*"}
    Dim proxy As New WebProxy("http://contoso", bypassLocal, bypassList)

    ' Test the bypass list.
    If Not proxy.IsBypassed(New Uri("")) Then
        Console.WriteLine("Bypass not working!")
        Return Nothing
        Console.WriteLine("Bypass is working.")
        Return proxy
    End If
End Function

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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