Skip to main content

WebProxy Class

Namespace: System.Net · Assembly: GHIElectronics.TinyCLR.Networking.Http

Contains HTTP proxy settings for the System.Net.WebRequest class.

public class WebProxy : IWebProxy

Constructors

WebProxy()

public WebProxy() : this((Uri)null, false)

Initializes an empty instance of the WebProxy class.

WebProxy(Uri Address)

public WebProxy(Uri Address) : this(Address, false)

Initializes a new instance of the WebProxy class from the specified System.Uri instance.

ParameterTypeDescription
AddressUriA Uri instance that contains the address of the proxy server.

WebProxy(Uri Address, bool BypassOnLocal)

public WebProxy(Uri Address, bool BypassOnLocal)

Initializes a new instance of the WebProxy class with the specified System.Uri instance and bypass setting.

ParameterTypeDescription
AddressUriA Uri instance that contains the address of the proxy server.
BypassOnLocalboolIndicates whether to bypass the WebProxy on local network addresses.

WebProxy(string Host, int Port)

public WebProxy(string Host, int Port) : this(new Uri( + Host + + Port.ToString()), false)

Initializes a new instance of the WebProxy class with the specified host and port number.

ParameterTypeDescription
HoststringThe name of the proxy host, such as: contoso
PortintThe port number on the host to use, such as: 80

WebProxy(string Address)

public WebProxy(string Address) : this(CreateProxyUri(Address), false)

Initializes a new instance of the WebProxy class with the specified URI.

ParameterTypeDescription
AddressstringThe URI address of the proxy server.

WebProxy(string Address, bool BypassOnLocal)

public WebProxy(string Address, bool BypassOnLocal) : this(CreateProxyUri(Address), BypassOnLocal)

Initializes a new instance of the WebProxy class with the specified URI and bypass setting.

ParameterTypeDescription
AddressstringThe URI of the proxy server.
BypassOnLocalboolIndicates whether to bypass the proxy when accessing local addresses.

Properties

Address

public Uri Address { get; set; }

Gets or sets the address of the proxy server.

BypassProxyOnLocal

public bool BypassProxyOnLocal { get; set; }

Gets or sets whether to bypass the proxy server for local addresses.

Methods

GetProxy(Uri destination)

public Uri GetProxy(Uri destination)

Returns the proxied URI for a request.

ParameterTypeDescription
destinationUriThe 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, the Uri instance of the proxy.

IsBypassed(Uri host)

public bool IsBypassed(Uri host)

Indicates whether to use the proxy server for the specified host.

ParameterTypeDescription
hostUriThe 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 .