Export (0) Print
Expand All

IWebProxy.IsBypassed Method

Indicates that the proxy should not be used for the specified host.

[Visual Basic]
Function IsBypassed( _
   ByVal host As Uri _
) As Boolean
[C#]
bool IsBypassed(
   Uri host
);
[C++]
bool IsBypassed(
   Uri* host
);
[JScript]
function IsBypassed(
   host : Uri
) : Boolean;

Parameters

host
The Uri of the host to check for proxy use.

Return Value

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

Remarks

The IsBypassed method indicates whether to use the proxy server to access the host specified in the host parameter. If IsBypassed is true, the proxy is not used to contact the host and the request is passed directly to the server.

Example

[Visual Basic, C#, C++] The following example uses the IsBypassed property to determine if the proxy server should be used for the specified host.

[Visual Basic] 

 Public Shared Sub Main()
     Dim webProxy_Interface As New WebProxy_Interface(New Uri("http://proxy.server.com"))
     
     webProxy_Interface.Credentials = New NetworkCredential("microsoft", ".Net")
     
     Console.WriteLine("The web proxy is : {0}", webProxy_Interface.GetProxy(New Uri("http://www.microsoft.com")))
     
     'Check if the webproxy can ne bypassed for the site "http://www.microsoft.com".
 console.writeline("For the Uri http://www.microsoft.com , the ")
     If webProxy_Interface.IsBypassed(New Uri("http://www.microsoft.com")) Then
         Console.WriteLine("webproxy is by passed")
     Else
         Console.WriteLine("webproxy is not bypassed")
     End If 
 End Sub 'Main


[C#] 
WebProxy_Interface webProxy_Interface = new WebProxy_Interface(new Uri("http://proxy.server.com"));

webProxy_Interface.Credentials = new NetworkCredential("microsoft", ".Net");

Console.WriteLine("The web proxy is : {0}", webProxy_Interface.GetProxy(new Uri("http://www.microsoft.com")));

// Check if the webproxy can ne bypassed for the site "http://www.microsoft.com".
if(webProxy_Interface.IsBypassed(new Uri("http://www.microsoft.com")))
    Console.WriteLine("Web Proxy is by passed");
else
    Console.WriteLine("Web Proxy is not by passed");


[C++] 
WebProxy_Interface* webProxy_Interface =
   new WebProxy_Interface(new Uri(S"http://proxy.server.com"));
webProxy_Interface->Credentials =
   new NetworkCredential(S"microsoft", S".Net");

Console::WriteLine(S"The web proxy is : {0}",
   webProxy_Interface->GetProxy(new Uri(S"http://www.microsoft.com")));

// Check if the webproxy can ne bypassed for the site S"http://www.microsoft.com".
if (webProxy_Interface->IsBypassed(new Uri(S"http://www.microsoft.com")))
   Console::WriteLine(S"Web Proxy is by passed");
else
   Console::WriteLine(S"Web Proxy is not by passed");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

IWebProxy Interface | IWebProxy Members | System.Net Namespace

Show:
© 2015 Microsoft