Export (0) Print
Expand All
3 out of 3 rated this helpful - Rate this topic

WebProxy Class

Contains HTTP proxy settings for the WebRequest class.

For a list of all members of this type, see WebProxy Members.

System.Object
   System.Net.WebProxy

[Visual Basic]
<Serializable>
Public Class WebProxy
   Implements IWebProxy, ISerializable
[C#]
[Serializable]
public class WebProxy : IWebProxy, ISerializable
[C++]
[Serializable]
public __gc class WebProxy : public IWebProxy, ISerializable
[JScript]
public
   Serializable
class WebProxy implements IWebProxy, ISerializable

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

The WebProxy class contains the proxy settings that WebRequest instances use to override the proxy settings in GlobalProxySelection.

The WebProxy class is the base implementation of the IWebProxy interface.

Example

[Visual Basic, C#, C++] The following example assigns a WebProxy to a WebRequest. The WebRequest instance uses the proxy to connect to external Internet resources.

[Visual Basic] 
Dim proxyObject As New WebProxy("http://proxyserver:80/", True)
Dim req As WebRequest = WebRequest.Create("http://www.contoso.com")
req.Proxy = proxyObject


[C#] 
WebProxy proxyObject = new WebProxy("http://proxyserver:80/",true);
WebRequest req = WebRequest.Create("http://www.contoso.com");
req.Proxy = proxyObject;


[C++] 
WebProxy* proxyObject = new WebProxy(S"http://proxyserver:80/",true);
WebRequest* req = WebRequest::Create(S"http://www.contoso.com");
req->Proxy = proxyObject;

[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

Namespace: System.Net

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

Assembly: System (in System.dll)

See Also

WebProxy Members | System.Net Namespace

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.