HttpWebClientProtocol.Proxy Egenskap

Definition

Hämtar eller anger proxyinformation för att göra en XML-webbtjänstbegäran via en brandvägg.

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

Egenskapsvärde

En IWebProxy som innehåller proxyinformation för att göra begäranden via en brandvägg. Standardvärdet är operativsystemets proxyinställningar.

Attribut

Exempel

I följande exempel anges följande proxyinställningar innan XML-webbtjänsten anropas Math : proxyservern till http://proxyserver, proxyporten till 80 och förbikopplingen till proxyservern för lokala adresser.

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)

Kommentarer

Använd egenskapen Proxy om en klient behöver använda andra proxyinställningar än de i systeminställningarna. WebProxy Använd klassen för att ange proxyinställningarna eftersom den implementerar IWebProxy.

Standardproxyinställningar kan anges i en konfigurationsfil. Mer information finns i Konfigurera Internetprogram.

Gäller för

Se även