共用方式為


HttpClientHandler.Proxy 屬性

定義

取得或設定處理者使用的代理資訊。

public:
 property System::Net::IWebProxy ^ Proxy { System::Net::IWebProxy ^ get(); void set(System::Net::IWebProxy ^ value); };
public System.Net.IWebProxy Proxy { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.Runtime.Versioning.UnsupportedOSPlatform("ios")]
[System.Runtime.Versioning.UnsupportedOSPlatform("tvos")]
public System.Net.IWebProxy? Proxy { get; set; }
[System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public System.Net.IWebProxy? Proxy { get; set; }
member this.Proxy : System.Net.IWebProxy with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("ios")>]
[<System.Runtime.Versioning.UnsupportedOSPlatform("tvos")>]
member this.Proxy : System.Net.IWebProxy with get, set
[<System.Runtime.Versioning.UnsupportedOSPlatform("browser")>]
member this.Proxy : System.Net.IWebProxy with get, set
Public Property Proxy As IWebProxy

屬性值

處理者使用的代理資訊。 預設值為 null

屬性

備註

Proxy 屬性用 WebProxy 以識別用於處理對網際網路資源請求的物件。 若要指定不應使用 Proxy,請將 Proxy 屬性設定為 GetEmptyWebProxy 方法所傳回的 Proxy 執行個體。

本地電腦或應用程式設定檔可能會指定使用預設代理檔。 若指定了該 Proxy 屬性,則該 Proxy 屬性中的代理設定會覆蓋本地電腦或應用程式設定檔,處理器將使用指定的代理設定。 若設定檔 Proxy 中未指定代理且該屬性未指定,處理器將使用從本地電腦的網際網路選項繼承的代理設定。 如果網際網路選項中沒有代理設定,請求會直接送達伺服器。

HttpClientHandler 類別支援本地 Proxy 略過。 如果符合下列任何條件,該類別會將目的地視為本地:

  • 目的地名稱為平面名稱(網址中無點)。
  • 目的地包含迴圈位址(LoopbackIPv6Loopback),或目的地包含指派給本地電腦的位址 IPAddress
  • 目的地的網域後綴與本地電腦的網域後綴DomainName()相符。

適用於