Class WebProxy
Contains HTTP proxy settings for the WebRequest class.
public class WebProxy : IWebProxy
- Inheritance
-
WebProxy
- Implements
- Inherited Members
- Extension Methods
Constructors
WebProxy()
Initializes an empty instance of the WebProxy class.
public WebProxy()
Remarks
The URI of the proxy can be set later, using the Address property.
WebProxy(string)
Initializes a new instance of the
public WebProxy(string Address)
Parameters
Address
stringThe URI address of the proxy server.
Remarks
The
For the new instance of the
WebProxy(string, bool)
Initializes a new instance of the
public WebProxy(string Address, bool BypassOnLocal)
Parameters
Address
stringThe URI of the proxy server.
BypassOnLocal
boolIndicates whether to bypass the proxy when accessing local addresses.
WebProxy(string, int)
Initializes a new instance of the
public WebProxy(string Host, int Port)
Parameters
Host
stringThe name of the proxy host, such as: contoso
Port
intThe port number on the host to use, such as: 80
Remarks
The
WebProxy(Uri)
Initializes a new instance of the
public WebProxy(Uri Address)
Parameters
Address
UriA
Uri instance that contains the address of the proxy server.
WebProxy(Uri, bool)
Initializes a new instance of the
public WebProxy(Uri Address, bool BypassOnLocal)
Parameters
Address
UriA
Uri instance that contains the address of the proxy server.BypassOnLocal
boolIndicates whether to bypass the WebProxy on local network addresses.
Properties
Address
Gets or sets the address of the proxy server.
public Uri Address { get; set; }
Property Value
BypassProxyOnLocal
Gets or sets whether to bypass the proxy server for local addresses.
public bool BypassProxyOnLocal { get; set; }
Property Value
- bool
true to bypass the proxy server for local addresses; otherwise,false .
Methods
GetProxy(Uri)
Returns the proxied URI for a request.
public Uri GetProxy(Uri destination)
Parameters
destination
UriThe
Uri instance of the requested Internet resource.
Returns
- Uri
The
Uri instance of the Internet resource, if the resource is on the bypass list; otherwise, theUri instance of the proxy.
IsBypassed(Uri)
Indicates whether to use the proxy server for the specified host.
public bool IsBypassed(Uri host)
Parameters
host
UriThe
Uri instance of the host to check for proxy use.
Returns
- bool
true if the proxy server should not be used for the host; otherwise,false .