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. 將會清空剩餘的資料和通訊端時,會重複使用的後續要求關閉回應物件或資料流,如果下列條件: keep-alive 或管線的要求,只有少量的資料需要被接收,或小型時間間隔內接收到剩餘的資料。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. 如為 keep-alive 或以管線連接時,我們強烈建議應用程式讀取資料流,直到 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 標頭值傳送至網際網路資源,為屬性,設定方法,或是由系統; 所設定下表包含完整的清單。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.

頁首Header 設定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.
主機Host 由系統目前的主機資訊設定。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://.

在本機電腦或應用程式組態檔,可能會指定使用預設 proxy。The local computer or application config file may specify that a default proxy be used. 如果Proxy指定屬性,然後從的 proxy 設定Proxy屬性會覆寫本機電腦或應用程式組態檔和HttpWebRequest執行個體將會使用指定的 proxy 設定。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 在組態檔中,Proxy屬性未指定,HttpWebRequest類別會使用繼承自 Internet Explorer 中,在本機電腦上的 proxy 設定。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 proxy 設定,要求會直接傳送到伺服器。If there are no proxy settings in Internet Explorer, the request is sent directly to the server.

HttpWebRequest類別可剖析 proxy 略過清單包含繼承自 Internet Explorer 以不同的方式略過清單由 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 Explorer 略過清單做為規則運算式的 「 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」 會略過 proxy 使用HttpWebRequest類別,但不是會略過使用 Internet Explorer 的 proxy。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

取得實際回應要求的網際網路資源統一資源識別元 (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

取得或設定值,這個值表示是否要緩衝處理從網際網路資源接收的資料。Gets or sets a value that indicates whether to buffer the received from the Internet resource.

AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering AllowWriteStreamBuffering

取得或設定值,指出是否要緩衝傳送至網際網路資源的資料。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

取得或設定從網際網路資源接收 HTTP 100-continue 回應時所呼叫的委派 (Delegate) 方法。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 類別的 Factory 物件,用來建立執行個體化的 WebRequest 以對指定的 URI 提出要求。When 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

取得值,指出是否已經接收到來自網際網路資源的回應。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

取得或設定 Host 標頭值,以用在獨立於要求 URI 的 HTTP 要求中。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

取得或設定值,指出是否要與網際網路資源建立持續連線。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

取得或設定值,指出是否將要求導送至網際網路資源。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

取得或設定要求的 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

取得或設定值,指出是否要分區段傳送資料至網際網路資源。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()

取消對網際網路資源的要求。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)

針對從已要求資料的起始或結尾的特定範圍,將範圍標頭加入至要求。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)

針對從已要求資料的起始或結尾的特定範圍,將範圍標頭加入至要求。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)

開始對網際網路資源的非同步要求。Begins an asynchronous request to an Internet resource.

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

建立包含所有相關資訊的物件,這些資訊是產生用來與遠端物件通訊的所需 Proxy。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)

結束對網際網路資源的非同步要求。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()

擷取控制這個執行個體存留期 (Lifetime) 原則的目前存留期服務物件。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()

在子代類別中覆寫時,傳回以非同步作業方式將資料寫入網際網路資源的 StreamWhen 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()

傳回來自網際網路資源的回應。Returns a response from an Internet resource.

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

在子代類別中覆寫時,傳回對網際網路要求的回應,做為非同步作業。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

適用於

另請參閱