WebRequestHandler 类

定义

提供不可用于 Windows Store 应用程序或其他环境的特定以桌面的功能。Provides desktop-specific features not available to Windows Store apps or other environments.

public ref class WebRequestHandler : System::Net::Http::HttpClientHandler
public class WebRequestHandler : System.Net.Http.HttpClientHandler
type WebRequestHandler = class
    inherit HttpClientHandler
Public Class WebRequestHandler
Inherits HttpClientHandler
继承

注解

此类通过使用 HttpWebRequest 实例将 HTTP 请求发送到服务器来实现传输处理程序。This class implements a transport handler using HttpWebRequest instances to send HTTP requests to servers.

构造函数

WebRequestHandler()

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

属性

AllowAutoRedirect

获取或设置一个值,该值指示处理程序是否应跟随重定向响应。Gets or sets a value that indicates whether the handler should follow redirection responses.

(继承自 HttpClientHandler)
AllowPipelining

获取或设置一个值,该值指示是否通过管线将请求传输到 Internet 资源。Gets or sets a value that indicates whether to pipeline the request to the Internet resource.

AuthenticationLevel

获取或设置指示用于此请求的身份验证和模拟的级别的值。Gets or sets a value indicating the level of authentication and impersonation used for this request.

AutomaticDecompression

获取或设置处理程序用于自动解压缩 HTTP 内容响应的解压缩方法类型。Gets or sets the type of decompression method used by the handler for automatic decompression of the HTTP content response.

(继承自 HttpClientHandler)
CachePolicy

获取或设置此请求的缓存策略。Gets or sets the cache policy for this request.

CheckCertificateRevocationList

获取或设置一个值,该值指示是否根据证书颁发机构吊销列表检查证书。Gets or sets a value that indicates whether the certificate is checked against the certificate authority revocation list.

(继承自 HttpClientHandler)
ClientCertificateOptions

获取或设置一个值,该值指示是否从证书存储自动挑选证书,或者是否允许调用方通过特定的客户端证书。Gets or sets a value that indicates if the certificate is automatically picked from the certificate store or if the caller is allowed to pass in a specific client certificate.

(继承自 HttpClientHandler)
ClientCertificates

获取或设置与此请求关联的安全证书集合。Gets or sets the collection of security certificates that are associated with this request.

ContinueTimeout

获取或设置应用程序在上载数据前等待来自服务器的 100 连续的时间量(毫秒)。Gets or sets the amount of time, in milliseconds, the application will wait for 100-continue from the server before uploading data.

CookieContainer

获取或设置用于通过处理程序存储服务器 Cookie 的 Cookie 容器。Gets or sets the cookie container used to store server cookies by the handler.

(继承自 HttpClientHandler)
Credentials

获取或设置此处理程序使用的身份验证信息。Gets or sets authentication information used by this handler.

(继承自 HttpClientHandler)
DefaultProxyCredentials

使用默认(系统)代理时,获取或设置要提交到默认代理服务器进行身份验证的凭据。When the default (system) proxy is being used, gets or sets the credentials to submit to the default proxy server for authentication. 只有在 UseProxy 设置为 trueProxy 设置为 null 时才使用默认代理。The default proxy is used only when UseProxy is set to true and Proxy is set to null.

(继承自 HttpClientHandler)
ImpersonationLevel

获取或设置当前请求的模拟级别。Gets or sets the impersonation level for the current request.

MaxAutomaticRedirections

获取或设置处理程序遵循的重定向的最大数目。Gets or sets the maximum number of redirects that the handler follows.

(继承自 HttpClientHandler)
MaxConnectionsPerServer

获取或设置使用 HttpClient 对象发出请求时允许的最大并发连接数(每个服务器终结点)。Gets or sets the maximum number of concurrent connections (per server endpoint) allowed when making requests using an HttpClient object. 请注意,该限制针对每个服务器终结点,例如,值为 256 表示允许 256 个到 http://www.adatum.com/ 的并发连接,以及另外 256 个到 http://www.adventure-works.com/ 的并发连接。Note that the limit is per server endpoint, so for example a value of 256 would permit 256 concurrent connections to http://www.adatum.com/ and another 256 to http://www.adventure-works.com/.

(继承自 HttpClientHandler)
MaxRequestContentBufferSize

获取或设置处理程序使用的最大请求内容缓冲区大小。Gets or sets the maximum request content buffer size used by the handler.

(继承自 HttpClientHandler)
MaxResponseHeadersLength

获取或设置响应标头允许的最大长度。Gets or sets the maximum allowed length of the response headers.

PreAuthenticate

获取或设置一个值,该值指示处理程序是否随请求发送授权标头。Gets or sets a value that indicates whether the handler sends an Authorization header with the request.

(继承自 HttpClientHandler)
Properties

获取 HttpClient 的自定义属性的可写字典(即地图)。Gets a writable dictionary (that is, a map) of custom properties for the HttpClient requests. 初始字典为空;可以为自定义处理程序和特殊处理插入和查询键值对。The dictionary is initialized empty; you can insert and query key-value pairs for your custom handlers and special processing.

(继承自 HttpClientHandler)
Proxy

获取或设置处理程序使用的代理信息。Gets or sets proxy information used by the handler.

(继承自 HttpClientHandler)
ReadWriteTimeout

获取或设置写入请求或读取服务器中的相应时的超时(以毫秒为单位)。Gets or sets a time-out in milliseconds when writing a request to or reading a response from a server.

ServerCertificateCustomValidationCallback

获取或设置用于验证服务器证书的回调方法。Gets or sets a callback method to validate the server certificate.

(继承自 HttpClientHandler)
ServerCertificateValidationCallback

获取或设置用于验证服务器证书的回调方法。Gets or sets a callback method to validate the server certificate.

SslProtocols

获取或设置 HttpClientHandler 对象管理的 HttpClient 对象所用的 TLS/SSL 协议。Gets or sets the TLS/SSL protocol used by the HttpClient objects managed by the HttpClientHandler object.

(继承自 HttpClientHandler)
SupportsAutomaticDecompression

获取一个值,该值指示处理程序是否支持自动响应内容解压缩。Gets a value that indicates whether the handler supports automatic response content decompression.

(继承自 HttpClientHandler)
SupportsProxy

获取一个值,该值指示处理程序是否支持代理设置。Gets a value that indicates whether the handler supports proxy settings.

(继承自 HttpClientHandler)
SupportsRedirectConfiguration

获取一个值,该值表示处理程序是否支持 AllowAutoRedirectMaxAutomaticRedirections 属性的配置设置。Gets a value that indicates whether the handler supports configuration settings for the AllowAutoRedirect and MaxAutomaticRedirections properties.

(继承自 HttpClientHandler)
UnsafeAuthenticatedConnectionSharing

获取或设置一个值,该值指示是否允许经过高速 NTLM 身份验证的连接共享。Gets or sets a value that indicates whether to allow high-speed NTLM-authenticated connection sharing.

UseCookies

获取或设置一个值,该值指示处理程序是否使用 CookieContainer 属性来存储服务器 Cookie 并在发送请求时使用这些 Cookie。Gets or sets a value that indicates whether the handler uses the CookieContainer property to store server cookies and uses these cookies when sending requests.

(继承自 HttpClientHandler)
UseDefaultCredentials

获取或设置一个值,该值控制处理程序是否随请求一起发送默认凭据。Gets or sets a value that controls whether default credentials are sent with requests by the handler.

(继承自 HttpClientHandler)
UseProxy

获取或设置一个值,该值表示处理程序是否对请求使用代理。Gets or sets a value that indicates whether the handler uses a proxy for requests.

(继承自 HttpClientHandler)

方法

Dispose()

释放由 HttpMessageHandler 使用的非托管资源和托管资源。Releases the unmanaged resources and disposes of the managed resources used by the HttpMessageHandler.

(继承自 HttpMessageHandler)
Dispose(Boolean)

释放由 HttpClientHandler 使用的非托管资源,并可根据需要释放托管资源。Releases the unmanaged resources used by the HttpClientHandler and optionally disposes of the managed resources.

(继承自 HttpClientHandler)
Equals(Object)

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

(继承自 Object)
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)
Send(HttpRequestMessage, CancellationToken)

基于在 HttpRequestMessage 中提供的信息创建 HttpResponseMessage 的实例。Creates an instance of HttpResponseMessage based on the information provided in the HttpRequestMessage.

(继承自 HttpClientHandler)
SendAsync(HttpRequestMessage, CancellationToken)

基于作为不会阻止的操作在 HttpRequestMessage 中提供的信息创建 HttpResponseMessage 的实例。Creates an instance of HttpResponseMessage based on the information provided in the HttpRequestMessage as an operation that will not block.

(继承自 HttpClientHandler)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于