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 | |
---|---|---|
WebProxy() () () () | Initializes an empty instance of the WebProxy class. | |
WebProxy(String) | Initializes a new instance of the WebProxy class with the specified URI. | |
WebProxy(Uri) | Initializes a new instance of the WebProxy class from the specified Uri instance. | |
WebProxy(String, Boolean) | Initializes a new instance of the WebProxy class with the specified URI and bypass setting. | |
WebProxy(String, Int32) | Initializes a new instance of the WebProxy class with the specified host and port number. | |
WebProxy(Uri, Boolean) | Initializes a new instance of the WebProxy class with the Uri instance and bypass setting. |
Top
Properties
Name | Description | |
---|---|---|
Address | Gets or sets the address of the proxy server. | |
BypassProxyOnLocal | Gets or sets a value that indicates whether to bypass the proxy server for local addresses. |
Top
Methods
Name | Description | |
---|---|---|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetProxy | Returns the proxied URI for a request. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsBypassed | Indicates whether to use the proxy server for the specified host. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
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.