WebProxy.IsBypassed(Uri) Yöntem

Tanım

Belirtilen konak için ara sunucunun kullanılıp kullanılmayacağını gösterir.

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

Parametreler

host
Uri

Ara Uri sunucu kullanımını denetlemek için konağın örneği.

Döndürülenler

true proxy sunucusu için hostkullanılmamalıdır; değilse, false.

Uygulamalar

Özel durumlar

host parametresi null'dir.

Örnekler

Aşağıdaki kod örneği bir WebProxy nesne oluşturur ve atlama listesinin düzgün ayarlanıp ayarlanmadığını denetlemek için bu yöntemi çağırır.

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;
    }
}

Açıklamalar

IsBypassed yöntemi, bir İnternet kaynağına erişirken proxy sunucusunun atlanıp atlanmayacağını belirlemek için kullanılır.

BypassProxyOnLocal ve BypassList özellikleri, yönteminin dönüş değerini IsBypassed denetler.

IsBypassed aşağıdaki koşullardan herhangi biri altında döndürür true :

  • BypassProxyOnLocal true ve host yerel bir URI ise. Yerel istekler, içinde olduğu gibi http://webserver/URI'de bir nokta (.) olmamasıyla tanımlanır.

  • içindeki hostnormal ifadeyle eşleşiyorsaBypassList.

  • ise Addressnull.

Diğer tüm koşullar döndürür false.

Şunlara uygulanır