HttpWebRequest HttpWebRequest HttpWebRequest HttpWebRequest Class

定义

提供 WebRequest 类的 HTTP 特定的实现。Provides an HTTP-specific implementation of the WebRequest class.

public ref class HttpWebRequest : System::Net::WebRequest, System::Runtime::Serialization::ISerializable
[System.Serializable]
public class HttpWebRequest : System.Net.WebRequest, System.Runtime.Serialization.ISerializable
type HttpWebRequest = class
    inherit WebRequest
    interface ISerializable
Public Class HttpWebRequest
Inherits WebRequest
Implements ISerializable
继承
属性
实现

示例

下面的代码示例将创建HttpWebRequesturi http://www.contoso.com/。The following code example creates an HttpWebRequest for the URI http://www.contoso.com/.

HttpWebRequest^ myReq = dynamic_cast<HttpWebRequest^>(WebRequest::Create( "http://www.contoso.com/" ));

HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://www.contoso.com/");


Dim myReq As HttpWebRequest = _
    WebRequest.Create("http://www.contoso.com/")

注解

重要

我们不建议你使用HttpWebRequest新的开发。We don't recommend that you use HttpWebRequest for new development. 请改用System.Net.Http.HttpClient类。Instead, use the System.Net.Http.HttpClient class.

HttpWebRequest类提供支持的属性和方法中定义WebRequest以及其他属性和方法,使用户直接通过 HTTP 与服务器交互。The HttpWebRequest class provides support for the properties and methods defined in WebRequest and for additional properties and methods that enable the user to interact directly with servers using HTTP.

不要使用HttpWebRequest构造函数。Do not use the HttpWebRequest constructor. 使用WebRequest.Create方法初始化新HttpWebRequest对象。Use the WebRequest.Create method to initialize new HttpWebRequest objects. 如果方案的统一资源标识符 (URI) 是http://https://Create返回HttpWebRequest对象。If the scheme for the Uniform Resource Identifier (URI) is http:// or https://, Create returns an HttpWebRequest object.

GetResponse方法中指定的资源发出同步请求RequestUri属性,并返回HttpWebResponse包含响应对象。The GetResponse method makes a synchronous request to the resource specified in the RequestUri property and returns an HttpWebResponse that contains the response object. 可以使用返回的流接收的响应数据GetResponseStreamThe response data can be received by using the stream returned by GetResponseStream. 如果关闭响应对象或响应流时,剩余数据将作废。If the response object or the response stream is closed, remaining data will be forfeited. 将耗尽剩余的数据并关闭流的响应对象,如果以下条件成立时,将为后续请求重新使用套接字: 它是保持活动状态或通过管线传输请求,只有少量的数据需要接收,或在较短时间间隔内收到剩余数据。The remaining data will be drained and the socket will be re-used for subsequent requests when closing the response object or stream if the following conditions hold: it's a keep-alive or pipelined request, only a small amount of data needs to be received, or the remaining data is received in a small time interval. 如果没有提到条件保存或超出消耗时间,将关闭套接字。If none of the mentioned conditions hold or the drain time is exceeded, the socket will be closed. 为保持活动状态或通过管道传递的连接,我们强烈建议在应用程序直到 EOF 读取流。For keep-alive or pipelined connections, we strongly recommend that the application reads the streams until EOF. 这可确保将生成更好的性能和更低的使用的资源的后续请求重复使用套接字。This ensures that the socket will be re-used for subsequent requests resulting in better performance and less resources used.

如果想要将数据发送到的资源GetRequestStream方法将返回Stream对象,用于将数据发送。When you want to send data to the resource, the GetRequestStream method returns a Stream object to use to send data. BeginGetRequestStreamEndGetRequestStream方法提供对发送数据流的异步访问。The BeginGetRequestStream and EndGetRequestStream methods provide asynchronous access to the send data stream.

客户端身份验证与HttpWebRequest,客户端证书必须安装在我的当前用户的证书存储。For client authentication with HttpWebRequest, the client certificate must be installed in the My certificate store of the current user.

HttpWebRequest类将引发WebException访问资源时出现错误时。The HttpWebRequest class throws a WebException when errors occur while accessing a resource. WebException.Status属性包含WebExceptionStatus值,该值指示错误的源。The WebException.Status property contains a WebExceptionStatus value that indicates the source of the error. WebException.StatusWebExceptionStatus.ProtocolError,则Response属性包含HttpWebResponse从资源接收。When WebException.Status is WebExceptionStatus.ProtocolError, the Response property contains the HttpWebResponse received from the resource.

HttpWebRequest 公开常见 HTTP 标头值作为属性发送到 Internet 资源,由方法,或设置由系统;下表包含的完整列表。HttpWebRequest exposes common HTTP header values sent to the Internet resource as properties, set by methods, or set by the system; the following table contains a complete list. 您可以在设置其他标头Headers属性作为名称/值对。You can set other headers in the Headers property as name/value pairs. 请注意服务器和缓存可能会更改或在请求过程中添加标头。Note that servers and caches may change or add headers during the request.

下表列出了通过属性或方法或系统设置的 HTTP 标头。The following table lists the HTTP headers that are set either by properties or methods or the system.

HeaderHeader 通过设置Set by
接受Accept 通过设置Accept属性。Set by the Accept property.
连接Connection 通过设置Connection属性,KeepAlive属性。Set by the Connection property, KeepAlive property.
内容长度Content-Length 通过设置ContentLength属性。Set by the ContentLength property.
Content-TypeContent-Type 通过设置ContentType属性。Set by the ContentType property.
期望Expect 通过设置Expect属性。Set by the Expect property.
日期Date 设置当前日期到系统。Set by the system to current date.
HostHost 设置为当前主机信息系统。Set by the system to current host information.
If-Modified-SinceIf-Modified-Since 通过设置IfModifiedSince属性。Set by the IfModifiedSince property.
范围Range 通过设置AddRange方法。Set by the AddRange method.
引用站点Referer 通过设置Referer属性。Set by the Referer property.
Transfer-EncodingTransfer-Encoding 通过设置TransferEncoding属性 (SendChunked属性必须为true)。Set by the TransferEncoding property (the SendChunked property must be true).
用户代理User-Agent 通过设置UserAgent属性。Set by the UserAgent property.

备注

HttpWebRequest 已自动注册。HttpWebRequest is registered automatically. 不需要调用RegisterPrefix方法来注册System.Net.HttpWebRequest之前使用 Uri 开头http://https://You do not need to call the RegisterPrefix method to register System.Net.HttpWebRequest before using URIs beginning with http:// or https://.

在本地计算机或应用程序配置文件可以指定使用默认代理。The local computer or application config file may specify that a default proxy be used. 如果Proxy指定属性,然后从的代理设置Proxy属性重写在本地计算机或应用程序配置文件和HttpWebRequest实例将使用指定的代理设置。If the Proxy property is specified, then the proxy settings from the Proxy property override the local computer or application config file and the HttpWebRequest instance will use the proxy settings specified. 如果未指定代理配置文件中,Proxy属性未指定,HttpWebRequest类使用继承自 Internet 资源管理器在本地计算机上的代理设置。If no proxy is specified in a config file and the Proxy property is unspecified, the HttpWebRequest class uses the proxy settings inherited from Internet Explorer on the local computer. 如果没有在 Internet Explorer 代理设置,该请求是直接发送到服务器。If there are no proxy settings in Internet Explorer, the request is sent directly to the server.

HttpWebRequest类继承自 Internet 资源管理器以不同的方式不是直接通过 Internet Explorer 分析跳过列表的通配符字符与分析代理跳过列表。The HttpWebRequest class parses a proxy bypass list with wildcard characters inherited from Internet Explorer differently than the bypass list is parsed directly by Internet Explorer. 例如,HttpWebRequest类分析的正则表达式的"nt *"从 Internet 资源管理器的跳过列表"nt。 $"。For example, the HttpWebRequest class will parse a bypass list of "nt*" from Internet Explorer as a regular expression of "nt.$". 这不同于 Internet Explorer 的本机行为。This differs from the native behavior of Internet Explorer. 因此的 URL"http://intxxxxx"将绕过代理帐户使用HttpWebRequest类,但将不使用 Internet Explorer 使用代理。So a URL of "http://intxxxxx" would bypass the proxy using the HttpWebRequest class, but would not bypass the proxy using Internet Explorer.

备注

框架缓存 SSL 会话,因为它们创建并尝试再次使用的会话缓存适用于新的请求,在可能的情况。The Framework caches SSL sessions as they are created and attempts to reuse a cached session for a new request, if possible. 在尝试以重复使用的 SSL 会话时,框架将使用的第一个元素ClientCertificates(如果没有一个),或尝试重复使用匿名会话,如果ClientCertificates为空。When attempting to reuse an SSL session, the Framework uses the first element of ClientCertificates (if there is one), or tries to reuse an anonymous sessions if ClientCertificates is empty.

备注

出于安全原因,默认情况下禁用了 cookie。For security reasons, cookies are disabled by default. 如果你想要使用 cookie,则使用CookieContainer属性,以便启用 cookie。If you want to use cookies, use the CookieContainer property to enable cookies.

.NET Framework 4.6 包括一个新的安全功能,将阻止不安全的密码和哈希算法的连接。The .NET Framework 4.6 includes a new security feature that blocks insecure cipher and hashing algorithms for connections. 默认情况下,使用 TLS/SSL 通过 HttpClient、 HttpWebRequest、 FTPClient,SmtpClient、 SslStream 等 Api 和面向.NET Framework 4.6 的应用程序获得更安全的行为。Applications using TLS/SSL through APIs such as HttpClient, HttpWebRequest, FTPClient, SmtpClient, SslStream, etc. and targeting .NET Framework 4.6 get the more-secure behavior by default.

开发人员可能想要选择退出此行为以便保持与带 RC4 服务及其现有 SSL3 服务或 TLS 互操作性。Developers may want to opt out of this behavior in order to maintain interoperability with their existing SSL3 services OR TLS w/ RC4 services. 这篇文章介绍了如何修改你的代码,以便禁用新行为。This article explains how to modify your code so that the new behavior is disabled.

构造函数

HttpWebRequest() HttpWebRequest() HttpWebRequest() HttpWebRequest()

初始化 HttpWebRequest 类的新实例。Initializes a new instance of the HttpWebRequest class. 此构造函数已过时。This constructor is obsolete.

HttpWebRequest(SerializationInfo, StreamingContext) HttpWebRequest(SerializationInfo, StreamingContext) HttpWebRequest(SerializationInfo, StreamingContext) HttpWebRequest(SerializationInfo, StreamingContext)

HttpWebRequestSerializationInfo 类的指定实例初始化 StreamingContext 类的新实例。Initializes a new instance of the HttpWebRequest class from the specified instances of the SerializationInfo and StreamingContext classes. 此构造函数已过时。This constructor is obsolete.

HttpWebRequest(Uri) HttpWebRequest(Uri) HttpWebRequest(Uri) HttpWebRequest(Uri)

属性

Accept Accept Accept Accept

获取或设置 Accept HTTP 标头的值。Gets or sets the value of the Accept HTTP header.

Address Address Address Address

获取实际响应请求的 Internet 资源的统一资源标识符 (URI)。Gets the Uniform Resource Identifier (URI) of the Internet resource that actually responds to the request.

AllowAutoRedirect AllowAutoRedirect AllowAutoRedirect AllowAutoRedirect

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

AllowReadStreamBuffering AllowReadStreamBuffering AllowReadStreamBuffering AllowReadStreamBuffering

获取或设置一个值,该值指示是否对从 Internet 资源接收的数据进行缓冲处理。Gets or sets a value that indicates whether to buffer the received from the Internet resource.

AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering

获取或设置一个值,该值指示是否对发送到 Internet 资源的数据进行缓冲处理。Gets or sets a value that indicates whether to buffer the data sent to the Internet resource.

AuthenticationLevel AuthenticationLevel AuthenticationLevel AuthenticationLevel

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

(Inherited from WebRequest)
AutomaticDecompression AutomaticDecompression AutomaticDecompression AutomaticDecompression

获取或设置所使用的解压缩类型。Gets or sets the type of decompression that is used.

CachePolicy CachePolicy CachePolicy CachePolicy

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

(Inherited from WebRequest)
ClientCertificates ClientCertificates ClientCertificates ClientCertificates

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

Connection Connection Connection Connection

获取或设置 Connection HTTP 标头的值。Gets or sets the value of the Connection HTTP header.

ConnectionGroupName ConnectionGroupName ConnectionGroupName ConnectionGroupName

获取或设置请求的连接组的名称。Gets or sets the name of the connection group for the request.

ContentLength ContentLength ContentLength ContentLength

获取或设置 Content-length HTTP 标头。Gets or sets the Content-length HTTP header.

ContentType ContentType ContentType ContentType

获取或设置 Content-type HTTP 标头的值。Gets or sets the value of the Content-type HTTP header.

ContinueDelegate ContinueDelegate ContinueDelegate ContinueDelegate

获取或设置当从 Internet 资源接收到 HTTP 100-continue 响应时调用的委托方法。Gets or sets the delegate method called when an HTTP 100-continue response is received from the Internet resource.

ContinueTimeout ContinueTimeout ContinueTimeout ContinueTimeout

获取或设置在接收到来自服务器的 100-Continue 之前要等待的超时(以毫秒为单位)。Gets or sets a timeout, in milliseconds, to wait until the 100-Continue is received from the server.

CookieContainer CookieContainer CookieContainer CookieContainer

获取或设置与此请求关联的 Cookie。Gets or sets the cookies associated with the request.

CreatorInstance CreatorInstance CreatorInstance CreatorInstance

当在子类中重写时,获取从 IWebRequestCreate 类派生的工厂对象,该类用于创建为生成对指定 URI 的请求而实例化的 WebRequestWhen overridden in a descendant class, gets the factory object derived from the IWebRequestCreate class used to create the WebRequest instantiated for making the request to the specified URI.

(Inherited from WebRequest)
Credentials Credentials Credentials Credentials

获取或设置请求的身份验证信息。Gets or sets authentication information for the request.

Date Date Date Date

获取或设置要在 HTTP 请求中使用的 Date HTTP 标头值。Gets or sets the Date HTTP header value to use in an HTTP request.

DefaultCachePolicy DefaultCachePolicy DefaultCachePolicy DefaultCachePolicy

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

DefaultMaximumErrorResponseLength DefaultMaximumErrorResponseLength DefaultMaximumErrorResponseLength DefaultMaximumErrorResponseLength

获取或设置 HTTP 错误响应的默认最大长度。Gets or sets the default maximum length of an HTTP error response.

DefaultMaximumResponseHeadersLength DefaultMaximumResponseHeadersLength DefaultMaximumResponseHeadersLength DefaultMaximumResponseHeadersLength

获取或设置 MaximumResponseHeadersLength 属性的默认值。Gets or sets the default for the MaximumResponseHeadersLength property.

Expect Expect Expect Expect

获取或设置 Expect HTTP 标头的值。Gets or sets the value of the Expect HTTP header.

HaveResponse HaveResponse HaveResponse HaveResponse

获取一个值,该值指示是否收到了来自 Internet 资源的响应。Gets a value that indicates whether a response has been received from an Internet resource.

Headers Headers Headers Headers

指定构成 HTTP 标头的名称/值对的集合。Specifies a collection of the name/value pairs that make up the HTTP headers.

Host Host Host Host

获取或设置要在 HTTP 请求中独立于请求 URI 使用的 Host 标头值。Gets or sets the Host header value to use in an HTTP request independent from the request URI.

IfModifiedSince IfModifiedSince IfModifiedSince IfModifiedSince

获取或设置 If-Modified-Since HTTP 标头的值。Gets or sets the value of the If-Modified-Since HTTP header.

ImpersonationLevel ImpersonationLevel ImpersonationLevel ImpersonationLevel

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

(Inherited from WebRequest)
KeepAlive KeepAlive KeepAlive KeepAlive

获取或设置一个值,该值指示是否与 Internet 资源建立持久性连接。Gets or sets a value that indicates whether to make a persistent connection to the Internet resource.

MaximumAutomaticRedirections MaximumAutomaticRedirections MaximumAutomaticRedirections MaximumAutomaticRedirections

获取或设置请求将跟随的重定向的最大数目。Gets or sets the maximum number of redirects that the request follows.

MaximumResponseHeadersLength MaximumResponseHeadersLength MaximumResponseHeadersLength MaximumResponseHeadersLength

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

MediaType MediaType MediaType MediaType

获取或设置请求的媒体类型。Gets or sets the media type of the request.

Method Method Method Method

获取或设置请求的方法。Gets or sets the method for the request.

Pipelined Pipelined Pipelined Pipelined

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

PreAuthenticate PreAuthenticate PreAuthenticate PreAuthenticate

获取或设置一个值,该值指示是否随请求发送一个身份验证标头。Gets or sets a value that indicates whether to send an Authorization header with the request.

ProtocolVersion ProtocolVersion ProtocolVersion ProtocolVersion

获取或设置用于请求的 HTTP 版本。Gets or sets the version of HTTP to use for the request.

Proxy Proxy Proxy Proxy

获取或设置请求的代理信息。Gets or sets proxy information for the request.

ReadWriteTimeout ReadWriteTimeout ReadWriteTimeout ReadWriteTimeout

获取或设置写入或读取流时的超时(以毫秒为单位)。Gets or sets a time-out in milliseconds when writing to or reading from a stream.

Referer Referer Referer Referer

获取或设置 Referer HTTP 标头的值。Gets or sets the value of the Referer HTTP header.

RequestUri RequestUri RequestUri RequestUri

获取请求的原始统一资源标识符 (URI)。Gets the original Uniform Resource Identifier (URI) of the request.

SendChunked SendChunked SendChunked SendChunked

获取或设置一个值,该值指示是否将数据分段发送到 Internet 资源。Gets or sets a value that indicates whether to send data in segments to the Internet resource.

ServerCertificateValidationCallback ServerCertificateValidationCallback ServerCertificateValidationCallback ServerCertificateValidationCallback

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

ServicePoint ServicePoint ServicePoint ServicePoint

获取用于请求的服务点。Gets the service point to use for the request.

SupportsCookieContainer SupportsCookieContainer SupportsCookieContainer SupportsCookieContainer

获取一个值,该值指示请求是否为 CookieContainer 提供支持。Gets a value that indicates whether the request provides support for a CookieContainer.

Timeout Timeout Timeout Timeout

获取或设置 GetResponse()GetRequestStream() 方法的超时值(以毫秒为单位)。Gets or sets the time-out value in milliseconds for the GetResponse() and GetRequestStream() methods.

TransferEncoding TransferEncoding TransferEncoding TransferEncoding

获取或设置 Transfer-encoding HTTP 标头的值。Gets or sets the value of the Transfer-encoding HTTP header.

UnsafeAuthenticatedConnectionSharing UnsafeAuthenticatedConnectionSharing UnsafeAuthenticatedConnectionSharing UnsafeAuthenticatedConnectionSharing

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

UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials UseDefaultCredentials

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

UserAgent UserAgent UserAgent UserAgent

获取或设置 User-agent HTTP 标头的值。Gets or sets the value of the User-agent HTTP header.

方法

Abort() Abort() Abort() Abort()

取消对 Internet 资源的请求。Cancels a request to an Internet resource.

AddRange(Int32) AddRange(Int32) AddRange(Int32) AddRange(Int32)

向请求添加从请求数据的开始处或结束处的特定范围的字节范围标头。Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

AddRange(Int32, Int32) AddRange(Int32, Int32) AddRange(Int32, Int32) AddRange(Int32, Int32)

向请求添加指定范围的字节范围标头。Adds a byte range header to the request for a specified range.

AddRange(Int64) AddRange(Int64) AddRange(Int64) AddRange(Int64)

向请求添加从请求数据的开始处或结束处的特定范围的字节范围标头。Adds a byte range header to a request for a specific range from the beginning or end of the requested data.

AddRange(Int64, Int64) AddRange(Int64, Int64) AddRange(Int64, Int64) AddRange(Int64, Int64)

向请求添加指定范围的字节范围标头。Adds a byte range header to the request for a specified range.

AddRange(String, Int32) AddRange(String, Int32) AddRange(String, Int32) AddRange(String, Int32)

向请求添加从请求数据的开始处或结束处计算的特定范围的 Range 标头。Adds a Range header to a request for a specific range from the beginning or end of the requested data.

AddRange(String, Int32, Int32) AddRange(String, Int32, Int32) AddRange(String, Int32, Int32) AddRange(String, Int32, Int32)

向请求添加指定范围的范围标头。Adds a range header to a request for a specified range.

AddRange(String, Int64) AddRange(String, Int64) AddRange(String, Int64) AddRange(String, Int64)

向请求添加从请求数据的开始处或结束处计算的特定范围的 Range 标头。Adds a Range header to a request for a specific range from the beginning or end of the requested data.

AddRange(String, Int64, Int64) AddRange(String, Int64, Int64) AddRange(String, Int64, Int64) AddRange(String, Int64, Int64)

向请求添加指定范围的范围标头。Adds a range header to a request for a specified range.

BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object) BeginGetRequestStream(AsyncCallback, Object)

开始对用于写入数据的 Stream 对象执行异步请求。Begins an asynchronous request for a Stream object to use to write data.

BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object) BeginGetResponse(AsyncCallback, Object)

开始对 Internet 资源的异步请求。Begins an asynchronous request to an Internet resource.

CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(Inherited from MarshalByRefObject)
EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult) EndGetRequestStream(IAsyncResult)

结束对用于写入数据的 Stream 对象的异步请求。Ends an asynchronous request for a Stream object to use to write data.

EndGetRequestStream(IAsyncResult, TransportContext) EndGetRequestStream(IAsyncResult, TransportContext) EndGetRequestStream(IAsyncResult, TransportContext) EndGetRequestStream(IAsyncResult, TransportContext)

结束对用于写入数据的 Stream 对象的异步请求,并输出与该流关联的 TransportContextEnds an asynchronous request for a Stream object to use to write data and outputs the TransportContext associated with the stream.

EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult) EndGetResponse(IAsyncResult)

结束对 Internet 资源的异步请求。Ends an asynchronous request to an Internet resource.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

返回 WebRequest 实例的哈希值。Returns a hash value for a WebRequest instance.

GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext) GetObjectData(SerializationInfo, StreamingContext)

使用序列化目标对象所需的数据填充 SerializationInfoPopulates a SerializationInfo with the data required to serialize the target object.

GetRequestStream() GetRequestStream() GetRequestStream() GetRequestStream()

获取用于写入请求数据的 Stream 对象。Gets a Stream object to use to write request data.

GetRequestStream(TransportContext) GetRequestStream(TransportContext) GetRequestStream(TransportContext) GetRequestStream(TransportContext)

获取用于写入请求数据的 Stream 对象,并输出与该流关联的 TransportContextGets a Stream object to use to write request data and outputs the TransportContext associated with the stream.

GetRequestStreamAsync() GetRequestStreamAsync() GetRequestStreamAsync() GetRequestStreamAsync()

当在子类中被重写时,将用于写入数据的 Stream 作为异步操作返回到 Internet 资源。When overridden in a descendant class, returns a Stream for writing data to the Internet resource as an asynchronous operation.

(Inherited from WebRequest)
GetResponse() GetResponse() GetResponse() GetResponse()

返回来自 Internet 资源的响应。Returns a response from an Internet resource.

GetResponseAsync() GetResponseAsync() GetResponseAsync() GetResponseAsync()

当在子类中被重写时,将作为异步操作返回对 Internet 请求的响应。When overridden in a descendant class, returns a response to an Internet request as an asynchronous operation.

(Inherited from WebRequest)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(Inherited from MarshalByRefObject)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(Inherited from MarshalByRefObject)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

显式界面实现

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

使用将目标对象序列化所需的数据填充 SerializationInfoPopulates a SerializationInfo with the data needed to serialize the target object.

安全性

WebPermission
若要访问请求的 URI 或请求重定向到任何 URI。to access the requested URI or any URI that the request is redirected to. 关联的枚举: ConnectAssociated enumeration: Connect

适用于

另请参阅