WebProxy.IsBypassed(Uri) 메서드

정의

지정된 호스트에 프록시 서버를 사용할지 여부를 나타냅니다.

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

매개 변수

host
Uri

프록시 사용 여부를 확인할 호스트의 Uri 인스턴스입니다.

반환

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

구현

예외

host 매개 변수가 null인 경우

예제

다음 코드 예제에서는 개체를 WebProxy 만들고 바이패스 목록이 제대로 설정되었는지 여부를 검사 위해 이 메서드를 호출합니다.

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

    // Test the bypass list.
    if (!proxy.IsBypassed(new Uri("http://www.Contoso.com")))
    {
        Console.WriteLine("Bypass not working!");
        return null;
    }
    else
    {
        Console.WriteLine("Bypass is working.");
        return proxy;
    }
}

설명

메서드 IsBypassed 는 인터넷 리소스에 액세스할 때 프록시 서버를 바이패스할지 여부를 결정하는 데 사용됩니다.

및 속성은 BypassProxyOnLocal 메서드의 반환 값을 제어합니다IsBypassed.BypassList

IsBypassed 는 다음 조건 중에서 를 반환 true 합니다.

  • true 이고 host 가 로컬 URI이면 BypassProxyOnLocal 입니다. 로컬 요청은 에서와 같이 URI에서 마침표(.)가 없음으로 http://webserver/식별됩니다.

  • 의 정규식BypassList과 일치하는 경우 host

  • Addressnull인 경우입니다.

다른 모든 조건은 를 반환합니다 false.

적용 대상