HttpWebClientProtocol.Proxy 屬性

定義

取得或設定 Proxy 資訊,以製作穿越防火牆的 XML Web Service 要求。

public:
 property System::Net::IWebProxy ^ Proxy { System::Net::IWebProxy ^ get(); void set(System::Net::IWebProxy ^ value); };
[System.ComponentModel.Browsable(false)]
public System.Net.IWebProxy Proxy { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Proxy : System.Net.IWebProxy with get, set
Public Property Proxy As IWebProxy

屬性值

IWebProxy,包含用於產生穿越防火牆之要求的 Proxy 資訊。 預設值是作業系統 Proxy 設定。

屬性

範例

下列範例會先設定下列 Proxy 設定,再 Math 叫用 XML Web 服務:Proxy 伺服器至 http://proxyserver 、Proxy 埠設為 80,以及略過本機位址的 Proxy 伺服器。

MyMath::Math^ math = gcnew MyMath::Math;

// Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server
// for local addresses.
IWebProxy^ proxyObject = gcnew WebProxy( "http://proxyserver:80",true );
math->Proxy = proxyObject;

// Call the Add XML Web service method.
int total = math->Add( 8, 5 );

MyMath.Math math = new MyMath.Math();

// Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server
// for local addresses.
IWebProxy proxyObject = new WebProxy("http://proxyserver:80", true);
math.Proxy = proxyObject;

// Call the Add XML Web service method.
int total = math.Add(8, 5);
Dim math As New MyMath.Math()

' Set the proxy server to proxyserver, set the port to 80, and specify
' to bypass the proxy server for local addresses.
Dim proxyObject As New WebProxy("http://proxyserver:80", True)
math.Proxy = proxyObject

' Call the Add XML Web service method.
Dim total As Integer = math.Add(8, 5)

備註

Proxy如果用戶端需要使用與系統設定中的 Proxy 設定不同的 Proxy 設定,請使用 屬性。 使用 類別 WebProxy 來設定 Proxy 設定,因為它會實作 IWebProxy

您可以在組態檔中設定預設 Proxy 設定。 如需詳細資訊,請參閱 設定網際網路應用程式

適用於

另請參閱