WebProxy.BypassProxyOnLocal 屬性

定義

取得或設定值,這個值表示是否略過 Proxy 伺服器而改用本機位址。

public:
 property bool BypassProxyOnLocal { bool get(); void set(bool value); };
public bool BypassProxyOnLocal { get; set; }
member this.BypassProxyOnLocal : bool with get, set
Public Property BypassProxyOnLocal As Boolean

屬性值

true 表示略過 Proxy 伺服器而改用本機位址,否則為 false。 預設值是 false

範例

下列程式代碼範例示範如何呼叫建構函式來設定這個屬性並取得這個屬性的值。

WebProxy^ CreateProxyWithHostAddress( bool bypassLocal )
{
   WebProxy^ proxy = gcnew WebProxy( "http://contoso",bypassLocal );
   Console::WriteLine( "Bypass proxy for local URIs?: {0}", 
      proxy->BypassProxyOnLocal );
   return proxy;
}
public static WebProxy CreateProxyWithHostAddress(bool bypassLocal)
{
    WebProxy proxy =  new WebProxy("http://contoso", bypassLocal);
    Console.WriteLine("Bypass proxy for local URIs?: {0}",
       proxy.BypassProxyOnLocal);
    return proxy;
}

備註

屬性的 BypassProxyOnLocal 設定會決定存取本機因特網資源時是否要使用 Proxy 伺服器。

BypassProxyOnLocaltrue,則對於本機網際網路資源的要求不會使用 Proxy 伺服器。 本機要求是由 URI 中缺少句點 (.) 來識別,如 在 中 http://webserver/,或存取本地伺服器,包括 http://localhosthttp://loopbackhttp://127.0.0.1。 若 BypassProxyOnLocalfalse,則所有的網際網路要求都會經過 Proxy 伺服器。

注意

對包含期間之 URI 的本機主機要求會使用 Proxy。 若要避免在這些情況下使用 Proxy,請在 中 BypassList建立主機的專案。

適用於