Contains HTTP proxy settings for the HttpClient class.
public ref class WebProxy : System::Net::IWebProxy, System::Runtime::Serialization::ISerializable
public ref class WebProxy : System::Runtime::Serialization::ISerializable
public class WebProxy : System.Net.IWebProxy, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class WebProxy : System.Net.IWebProxy, System.Runtime.Serialization.ISerializable
[System.Serializable]
public class WebProxy : System.Runtime.Serialization.ISerializable
type WebProxy = class
interface IWebProxy
interface ISerializable
[<System.Serializable>]
type WebProxy = class
interface IWebProxy
interface ISerializable
Public Class WebProxy
Implements ISerializable, IWebProxy
Public Class WebProxy
Implements ISerializable
The following code example sets up an HttpClient instance with a WebProxy instance. The HttpClient instance uses the proxy to connect to external Internet resources. (For an example that demonstrates using the WPAD feature, see the documentation for the IWebProxyScript class.)
WebProxy proxyObject = new WebProxy("http://proxyserver:80/", true);
// HttpClient lifecycle management best practices:
// https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
HttpClient client = new HttpClient(new HttpClientHandler
{
Proxy = proxyObject
});
Dim proxyObject As New WebProxy("http://proxyserver:80/", True)
' HttpClient lifecycle management best practices:
' https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use
Dim client As New HttpClient(New HttpClientHandler With
{
.Proxy = proxyObject
})
The WebProxy class contains the proxy settings that HttpClient 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:
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
. When a request uses a WebProxy instance in this state, no proxy is used to send the request.
The GetDefaultProxy method returns an instance of the WebProxy class with the Address, BypassProxyOnLocal, and BypassList properties set to the values used by the local computer.
The Select method returns an instance of the WebProxy class with it properties set according to a combination of Internet and configuration file settings.
The WebProxy class supports automatic detection and execution of proxy configuration scripts. This feature is also known as Web Proxy Auto-Discovery (WPAD). When using automatic proxy configuration, a configuration script, typically named Wpad.dat, must be located, downloaded, compiled, and run. If these operations are successful, the script returns the proxies that can be used for a request.
Constructors WebProxy()Initializes an empty instance of the WebProxy class.
WebProxy(SerializationInfo, StreamingContext)Obsolete.
Initializes an instance of the WebProxy class using previously serialized content.
WebProxy(String, Boolean, String[], ICredentials)Initializes a new instance of the WebProxy class with the specified URI, bypass setting, list of URIs to bypass, and credentials.
WebProxy(String, Boolean, String[])Initializes a new instance of the WebProxy class with the specified URI, bypass setting, and list of URIs to bypass.
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(String)Initializes a new instance of the WebProxy class with the specified URI.
WebProxy(Uri, Boolean, String[], ICredentials)Initializes a new instance of the WebProxy class with the specified Uri instance, bypass setting, list of URIs to bypass, and credentials.
WebProxy(Uri, Boolean, String[])Initializes a new instance of the WebProxy class with the specified Uri instance, bypass setting, and list of URIs to bypass.
WebProxy(Uri, Boolean)Initializes a new instance of the WebProxy class with the Uri instance and bypass setting.
WebProxy(Uri)Initializes a new instance of the WebProxy class from the specified Uri instance.
Properties Methods Explicit Interface ImplementationsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4