Share via


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.

Inheritance Hierarchy

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

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

Syntax

'Declaration
Public Class WebProxy _
    Implements IWebProxy
public class WebProxy : IWebProxy
public ref class WebProxy : IWebProxy
type WebProxy =  
    class
        interface IWebProxy
    end
public class WebProxy implements IWebProxy

The WebProxy type exposes the following members.

Constructors

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

Top

Properties

  Name Description
Public property Address Gets or sets the address of the proxy server.
Public property BypassProxyOnLocal Gets or sets a value that indicates whether to bypass the proxy server for local addresses.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetProxy Returns the proxied URI for a request.
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method IsBypassed Indicates whether to use the proxy server for the specified host.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

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 null Nothing nullptr unit a 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.

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.

See Also

Reference

System.Net Namespace