Export (0) Print
Expand All

HttpWebClientProtocol.Proxy Property

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

[Visual Basic]
Public Property Proxy As IWebProxy
[C#]
public IWebProxy Proxy {get; set;}
[C++]
public: __property IWebProxy* get_Proxy();
public: __property void set_Proxy(IWebProxy*);
[JScript]
public function get Proxy() : IWebProxy;
public function set Proxy(IWebProxy);

Property Value

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

Remarks

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

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

Example

[Visual Basic, C#, C++] 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 to bypass the proxy server for local addresses.

[Visual Basic] 
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)
    . . . 
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)

[C#] 
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);

[C++] 
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(S"http://proxyserver:80", true);
math->Proxy = proxyObject;

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

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

HttpWebClientProtocol Class | HttpWebClientProtocol Members | System.Web.Services.Protocols Namespace | IWebProxy | WebProxy

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft