Editar

Compartir a través de


HttpWebClientProtocol.Proxy Property

Definition

Gets or sets proxy information for making an XML Web service request through a firewall.

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

Property Value

An IWebProxy that contains the proxy information for making requests through a firewall. The default value is the operating system proxy settings.

Attributes

Examples

The following example sets the following proxy settings prior to invoking the Math XML Web service: the proxy server to http://proxyserver, the proxy port to 80 and the bypass to the proxy server for local addresses.

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)

Remarks

Use the Proxy property if a client needs to use different proxy settings than those in the system settings. Use the WebProxy class to set the proxy settings, because it implements IWebProxy.

Default proxy settings can be set in a configuration file. For details, see Configuring Internet Applications.

Applies to

See also