WebProxy Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Contains HTTP proxy settings for the WebRequest class.

System..::..Object
  System.Net..::..WebProxy

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

public class WebProxy : IWebProxy

The WebProxy type exposes the following members.

  NameDescription
Public methodWebProxy()()()()Initializes an empty instance of the WebProxy class.
Public methodWebProxy(String)Initializes a new instance of the WebProxy class with the specified URI.
Public methodWebProxy(Uri)Initializes a new instance of the WebProxy class from the specified Uri instance.
Public methodWebProxy(String, Boolean)Initializes a new instance of the WebProxy class with the specified URI and bypass setting.
Public methodWebProxy(String, Int32)Initializes a new instance of the WebProxy class with the specified host and port number.
Public methodWebProxy(Uri, Boolean)Initializes a new instance of the WebProxy class with the Uri instance and bypass setting.
Top

  NameDescription
Public propertyAddressGets or sets the address of the proxy server.
Public propertyBypassProxyOnLocalGets or sets a value that indicates whether to bypass the proxy server for local addresses.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetProxyReturns the proxied URI for a request.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodIsBypassedIndicates whether to use the proxy server for the specified host.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The WebProxy class contains the proxy settings that WebRequest instances use to determine whether a Web proxy is used to send requests. Global Web proxy settings can be specified in machine and application configuration files, and applications can use instances of the WebProxy class to customize Web proxy use. The WebProxy class is the base implementation of the IWebProxy interface.

To obtain instances of the Web proxy class, you can use any of the following methods:

  • The WebProxy constructor.

  • The GetDefaultProxy method.

  • The Select method.

These methods each supply a WebProxy instance that you can further customize; the difference between them is how the instance is initialized before it is returned to your application. The WebProxy constructor returns an instance of the WebProxy class with the Address property set to nullNothingnullptrunita null reference (Nothing in Visual Basic). When a request uses a WebProxy instance in this state, no proxy is used to send the request.

The Select method returns an instance of the WebProxy class with it properties set according to a combination of Internet Explorer and configuration file settings.

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