This documentation is archived and is not being maintained.

WebProxy Class

Contains HTTP proxy settings for the WebRequest class.

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


[Visual Basic]
Public Class WebProxy
   Implements IWebProxy, ISerializable
public class WebProxy : IWebProxy, ISerializable
public __gc class WebProxy : public IWebProxy, ISerializable
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.


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.


[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("")
req.Proxy = proxyObject

WebProxy proxyObject = new WebProxy("http://proxyserver:80/",true);
WebRequest req = WebRequest.Create("");
req.Proxy = proxyObject;

WebProxy* proxyObject = new WebProxy(S"http://proxyserver:80/",true);
WebRequest* req = WebRequest::Create(S"");
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.


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