GlobalProxySelection 类

定义

警告

此 API 现已过时。

包含所有 HTTP 请求的全局默认代理实例。Contains a global default proxy instance for all HTTP requests.

public ref class GlobalProxySelection
[System.Obsolete("This class has been deprecated. Please use WebRequest.DefaultWebProxy instead to access and set the global default proxy. Use 'null' instead of GetEmptyWebProxy. https://go.microsoft.com/fwlink/?linkid=14202")]
[System.Obsolete("This class has been deprecated. Please use WebRequest.DefaultWebProxy instead to access and set the global default proxy. Use 'null' instead of GetEmptyWebProxy. https://go.microsoft.com/fwlink/?linkid=14202")]
[System.Obsolete("This class has been deprecated. Please use WebRequest.DefaultWebProxy instead to access and set the global default proxy. Use 'null' instead of GetEmptyWebProxy. http://go.microsoft.com/fwlink/?linkid=14202")]
public class GlobalProxySelection
type GlobalProxySelection = class
Public Class GlobalProxySelection
继承
GlobalProxySelection
属性

示例

下面的代码示例在端口80上设置名为 "webproxy" 的 HTTP 代理的 GlobalProxySelectionThe following code example sets the GlobalProxySelection for an HTTP proxy named "webproxy" on port 80.

Uri^ proxyURI = gcnew Uri( "http://webproxy:80" );
GlobalProxySelection::Select = gcnew WebProxy( proxyURI );
Uri proxyURI = new Uri("http://webproxy:80");
GlobalProxySelection.Select = new WebProxy(proxyURI);
Dim proxyURI As New Uri("http://webproxy:80")
GlobalProxySelection.Select = New WebProxy(proxyURI)

注解

GlobalProxySelection 存储 WebRequest 实例用来联系本地网络之外的 Internet 站点的默认代理的代理设置。The GlobalProxySelection stores the proxy settings for the default proxy that WebRequest instances use to contact Internet sites beyond the local network. 默认代理设置是从全局或应用程序配置文件中初始化的,可以通过将 HttpWebRequest.Proxy 属性设置为 GetEmptyWebProxy 方法的结果,对单个请求进行重写或禁用。The default proxy setting is initialized from the global or application configuration file, and can be overridden for individual requests or disabled by setting the HttpWebRequest.Proxy property to the result of the GetEmptyWebProxy method.

存储在 GlobalProxySelection 中的代理设置由支持代理的任何 WebRequest 派生对象使用,并将其 Proxy 属性值设置为 null (默认值)。The proxy settings stored in GlobalProxySelection are used by any WebRequest derived objects that support proxies and have their Proxy property value set to null (the default). FtpWebRequestHttpWebRequestWebClient目前支持代理。Proxies are currently supported by FtpWebRequest, HttpWebRequest, and WebClient.

注意发出请求后对 GlobalProxySelection 所做的更改不会反映在 WebRequest中。Note Changes to the GlobalProxySelection after a request is made are not reflected in a WebRequest.

构造函数

GlobalProxySelection()

初始化 GlobalProxySelection 类的新实例。Initializes a new instance of the GlobalProxySelection class.

属性

Select

获取或设置全局 HTTP 代理。Gets or sets the global HTTP proxy.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEmptyWebProxy()

返回空代理实例。Returns an empty proxy instance.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅