Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

WebProxy::IsBypassed Method

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

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

virtual bool IsBypassed(
	Uri^ host
) sealed


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

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.

WebProxy^ CreateProxyAndCheckBypass( bool bypassLocal )
   // Do not use the proxy server for Contoso.com URIs. 
   array<String^>^ bypassList = {";*.Contoso.com"};
   WebProxy^ proxy = gcnew WebProxy( "http://contoso",
      bypassList );

   // Test the bypass list. 
   if (  !proxy->IsBypassed( gcnew Uri( "http://www.Contoso.com" ) ) )
      Console::WriteLine( "Bypass not working!" );
      return nullptr;
      Console::WriteLine( "Bypass is working." );
      return proxy;
WebProxy* CreateProxyAndCheckBypass(bool bypassLocal)
    // Do not use the proxy server for Contoso.com URIs.
    String* bypassList[] = {S";*.Contoso.com"};
    WebProxy* proxy =  new WebProxy(S"http://contoso", 

    // Test the bypass list.
    if (!proxy->IsBypassed(new Uri(S"http://www.Contoso.com")))
        Console::WriteLine(S"Bypass not working!");
        return 0;
        Console::WriteLine(S"Bypass is working.");
        return proxy;

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

Community Additions

© 2015 Microsoft