Freigeben über


IWebProxy.IsBypassed-Methode

Gibt an, dass der Proxy nicht für den angegebenen Host verwendet werden soll.

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

Syntax

'Declaration
Function IsBypassed ( _
    host As Uri _
) As Boolean
'Usage
Dim instance As IWebProxy
Dim host As Uri
Dim returnValue As Boolean

returnValue = instance.IsBypassed(host)
bool IsBypassed (
    Uri host
)
bool IsBypassed (
    Uri^ host
)
boolean IsBypassed (
    Uri host
)
function IsBypassed (
    host : Uri
) : boolean

Parameter

  • host
    Der Uri des Hosts, der auf eine Proxyverwendung überprüft werden soll.

Rückgabewert

true, wenn der Proxyserver nicht für host verwendet werden soll, andernfalls false.

Hinweise

Die IsBypassed-Methode gibt an, ob der Proxyserver verwendet werden soll, um auf den im host-Parameter angegebenen Host zuzugreifen. Wenn IsBypassed den Wert true hat, wird die Verbindung mit dem Host nicht mithilfe des Proxys hergestellt, und die Anforderung wird direkt an den Server übergeben.

Beispiel

Im folgenden Beispiel wird mit der IsBypassed-Eigenschaft bestimmt, ob der Proxyserver für den angegebenen Host verwendet werden soll.

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

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

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

// Determine whether the Web proxy can be bypassed for the site "https://www.microsoft.com".
if(webProxy_Interface.IsBypassed(new Uri("https://www.microsoft.com")))
    Console.WriteLine("Web Proxy is by passed");
else
    Console.WriteLine("Web Proxy is not by passed");
WebProxy_Interface^ webProxy_Interface = gcnew WebProxy_Interface( gcnew Uri( "http://proxy.example.com" ) );

webProxy_Interface->Credentials = gcnew NetworkCredential( "microsoft",".Net" );

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

// Check if the webproxy can ne bypassed for the site S"https://www.microsoft.com".
if ( webProxy_Interface->IsBypassed( gcnew Uri( "https://www.microsoft.com" ) ) )
{
   Console::WriteLine( "Web Proxy is by passed" );
}
else
{
   Console::WriteLine( "Web Proxy is not by passed" );
}
WebProxyInterface webProxyInterface = new WebProxyInterface(
    new Uri("http://proxy.server.com"));
webProxyInterface.set_Credentials(new NetworkCredential(
    "microsoft", ".Net"));
Console.WriteLine("The web proxy is : {0}", webProxyInterface.
    GetProxy(new Uri("https://www.microsoft.com")));

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

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

IWebProxy-Schnittstelle
IWebProxy-Member
System.Net-Namespace