IWebProxy.IsBypassed(Uri) 메서드

정의

프록시를 지정된 호스트로 사용하지 말아야 함을 나타냅니다.

public:
 bool IsBypassed(Uri ^ host);
public bool IsBypassed (Uri host);
abstract member IsBypassed : Uri -> bool
Public Function IsBypassed (host As Uri) As Boolean

매개 변수

host
Uri

프록시 사용을 확인할 호스트의 Uri입니다.

반환

프록시 서버를 host로 사용하지 말아야 하면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 속성을 사용하여 IsBypassed 프록시 서버를 지정된 호스트에 사용해야 하는지 여부를 확인합니다.

WebProxy_Interface^ webProxy_Interface = gcnew WebProxy_Interface( gcnew Uri( "http://proxy.example.com" ) );

webProxy_Interface->Credentials = gcnew NetworkCredential( "myusername", "mypassword" );

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

// Check if the webproxy can ne bypassed for the site "http://www.contoso.com".
if ( webProxy_Interface->IsBypassed( gcnew Uri( "http://www.contoso.com" ) ) )
{
   Console::WriteLine( "Web Proxy is by passed" );
}
else
{
   Console::WriteLine( "Web Proxy is not by passed" );
}
WebProxy_Interface webProxy_Interface = new WebProxy_Interface(new Uri("http://proxy.example.com"));

webProxy_Interface.Credentials = new NetworkCredential("myusername", "mypassword");

Uri testUri = new Uri("http://www.contoso.com");

// Determine whether the Web proxy can be bypassed for the site "http://www.contoso.com".
if(webProxy_Interface.IsBypassed(testUri))
{
    Console.WriteLine("Web Proxy is by passed");
}
else
{
    Uri? webProxyServer = webProxy_Interface.GetProxy(testUri);
    // In general, we wouldn't expect the condition (`webProxyServer! == testUri`) true here, if  IsBypassed returns `false`.
    // However, technically our interface can allow that.
    if (webProxyServer is null || webProxyServer! == testUri)
    {
        Console.WriteLine("Web proxy is bypassed");
    }
    else
    {
        Console.WriteLine("Web proxy is not bypassed");
        Console.WriteLine($"The web proxy is: {webProxyServer!}");
    }
}

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

설명

메서드는 IsBypassed 프록시 서버를 사용하여 매개 변수에 지정된 host 호스트에 액세스할지 여부를 나타냅니다. 를 반환true하는 경우 IsBypassed 프록시는 호스트에 연락하는 데 사용되지 않으며 요청이 서버에 직접 전달됩니다. 에서 IsBypassed 가져오 false 더라도 URI가 프록시된다는 보장은 없습니다. 이를 확인하려면 메서드를 GetProxy 호출해야 합니다.

적용 대상