HttpResponseBase 類別

定義

代表類別的基底類別 (Base Class),這些類別提供來自 ASP.NET 作業的 HTTP 回應資訊。Represents the base class for classes that provides HTTP-response information from an ASP.NET operation.

public ref class HttpResponseBase abstract
public abstract class HttpResponseBase
type HttpResponseBase = class
Public MustInherit Class HttpResponseBase
繼承
HttpResponseBase
衍生

備註

HttpResponseBase類別是抽象類別,其包含與類別相同的成員 HttpResponseThe HttpResponseBase class is an abstract class that contains the same members as the HttpResponse class. HttpResponseBase類別可讓您建立類似類別的衍生類別 HttpResponse ,但您可以自訂和在 ASP.NET 管線之外工作。The HttpResponseBase class enables you to create derived classes that are like the HttpResponse class, but that you can customize and that work outside the ASP.NET pipeline. 當您執行單元測試時,通常會使用衍生類別來執行具有自訂行為的成員,以滿足您要測試的案例。When you perform unit testing, you typically use a derived class to implement members that have customized behavior that fulfills the scenario you are testing.

HttpResponseWrapper 類別衍生自 HttpResponseBase 類別。The HttpResponseWrapper class derives from the HttpResponseBase class. 類別可做為類別的包裝函式 HttpResponseWrapper HttpResponseThe HttpResponseWrapper class serves as a wrapper for the HttpResponse class. 在執行時間,您通常會使用類別的實例 HttpResponseWrapper 來呼叫物件的成員 HttpResponseAt run time, you typically use an instance of the HttpResponseWrapper class to call members of the HttpResponse object.

建構函式

HttpResponseBase()

初始化 HttpResponseBase 類別的新執行個體。Initializes a new instance of the HttpResponseBase class.

屬性

Buffer

取得或設定值,這個值表示是否要緩衝輸出並在整個回應處理完成之後將它送出。Gets or sets a value that indicates whether to buffer output and send it after the complete response has finished processing.

BufferOutput

取得或設定值,這個值表示是否要緩衝輸出並在整個頁面處理完成之後將它送出。Gets or sets a value that indicates whether to buffer output and send it after the complete page has finished processing.

Cache

取得目前頁面的快取原則 (例如,到期時間、隱私權設定與 Vary 子句)。Gets the caching policy (such as expiration time, privacy settings, and vary clauses) of the current Web page.

CacheControl

取得或設定符合其中一個 Cache-Control 列舉值的 HttpCacheability HTTP 標頭。Gets or sets the Cache-Control HTTP header that matches one of the HttpCacheability enumeration values.

Charset

取得或設定目前回應的 HTTP 字元集 (Character Set)。Gets or sets the HTTP character set of the current response.

ClientDisconnectedToken

取得用戶端中斷連接時發生錯誤的 CancellationToken 物件。Gets a CancellationToken object that is tripped when the client disconnects.

ContentEncoding

取得或設定目前回應的內容編碼方式。Gets or sets the content encoding of the current response.

ContentType

取得或設定目前回應的 HTTP MIME 類型。Gets or sets the HTTP MIME type of the current response.

Cookies

取得回應 Cookie 集合。Gets the response cookie collection.

Expires

取得或設定用戶端或 Proxy 上快取網頁到期以前的分鐘數。Gets or sets the number of minutes before a page that is cached on the client or proxy expires. 如果使用者在頁面到期前返回相同的頁面,則會顯示快取版本。If the user returns to the same page before it expires, the cached version is displayed. 提供 Expires 的目的在與舊版的 Active Server Pages (ASP) 相容。Expires is provided for compatibility with earlier versions of Active Server Pages (ASP).

ExpiresAbsolute

取得或設定快取資訊在快取中到期的絕對日期和時間。Gets or sets the absolute date and time at which cached information expires in the cache. ExpiresAbsolute 是提供來與 Active Server Pages (ASP) 先前版本相容。ExpiresAbsolute is provided for compatibility with earlier versions of Active Server Pages (ASP).

Filter

取得或設定用來在傳輸之前修改 HTTP 實體主體的篩選物件。Gets or sets a filter object that is used to modify the HTTP entity body before transmission.

HeaderEncoding

取得或設定目前回應之標頭的編碼方式。Gets or sets the encoding for the header of the current response.

Headers

取得回應標頭的集合。Gets the collection of response headers.

HeadersWritten

取得指出是否已寫入回應標頭的值。Gets a value indicating whether the response headers have been written.

IsClientConnected

取得值,這個值表示用戶端是否與伺服器連接。Gets a value that indicates whether the client is connected to the server.

IsRequestBeingRedirected

取得值,這個值表示是否要將用戶端重新導向至新位置。Gets a value that indicates whether the client is being redirected to a new location.

Output

取得讓文字輸出至 HTTP 回應資料流的物件。Gets the object that enables text output to the HTTP response stream.

OutputStream

取得物件,這個物件允許二進位輸出至連出 HTTP 內容主體。Gets the object that enables binary output to the outgoing HTTP content body.

RedirectLocation

取得或設定 Http Location 標頭的值。Gets or sets the value of the HTTP Location header.

Status

取得或設定傳回用戶端的 Status 值。Gets or sets the Status value that is returned to the client.

StatusCode

取得或設定傳回至用戶端的輸出之 HTTP 狀態碼。Gets or sets the HTTP status code of the output that is returned to the client.

StatusDescription

取得或設定傳回至用戶端的輸出之 HTTP 狀態訊息。Gets or sets the HTTP status message of the output that is returned to the client.

SubStatusCode

取得或設定值,這個值會評估回應的狀態碼是否符合。Gets or sets a value that qualifies the status code of the response.

SupportsAsyncFlush

取得值,表示連接是否支援非同步清除作業。Gets a value that indicates whether the connection supports asynchronous flush operation.

SuppressContent

取得或設定指出只否只有 HTTP 標頭會傳送給用戶端的值。Gets or sets a value that indicates whether only the HTTP headers will be sent to the client.

SuppressDefaultCacheControlHeader

取得或設定值,這個值表示是否要隱藏目前 HTTP 回應的預設 Cache Control: private 標頭。Gets or sets a value indicating whether to suppress the default Cache Control: private header for the current HTTP response.

SuppressFormsAuthenticationRedirect

取得或設定值,指定是否應該抑制表單驗證重新導向至登入頁面。Gets or sets a value that specifies whether forms authentication redirection to the login page should be suppressed.

TrySkipIisCustomErrors

取得或設定值,這個值會指定是否停用 IIS 7.0 的自訂錯誤。Gets or sets a value that specifies whether IIS 7.0 custom errors are disabled.

方法

AddCacheDependency(CacheDependency[])

加入快取相依性與回應的關聯,讓回應在快取後及指定的相依性變更時失效。Adds an associates cache dependencies with the response that enable the response to be invalidated if it is cached and if the specified dependencies change.

AddCacheItemDependencies(ArrayList)

讓快取回應的有效性取決於快取中的指定項目。Makes the validity of a cached response dependent on the specified items in the cache.

AddCacheItemDependencies(String[])

讓快取項目的有效性取決於快取中的指定項目。Makes the validity of a cached item dependent on the specified items in the cache.

AddCacheItemDependency(String)

讓快取回應的有效性取決於快取中的指定項目。Makes the validity of a cached response dependent on the specified item in the cache.

AddFileDependencies(ArrayList)

將檔案名稱加入至目前回應所相依之檔案名稱的集合。Adds file names to the collection of file names on which the current response is dependent.

AddFileDependencies(String[])

將檔案名稱陣列加入目前回應所依存的檔案名稱的集合。Adds an array of file names to the collection of file names on which the current response is dependent.

AddFileDependency(String)

將單一檔案名稱加入目前回應所依存的檔案名稱的集合。Adds a single file name to the collection of file names on which the current response is dependent.

AddHeader(String, String)

將 HTTP 標頭加入至目前回應。Adds an HTTP header to the current response. 提供這個方法的目的,是為了與 ASP 的舊版本相容。This method is provided for compatibility with earlier versions of ASP.

AddOnSendingHeaders(Action<HttpContextBase>)

註冊 ASP.NET 執行階段會立即在回應標頭傳送給這個要求之前叫用的回呼。Registers a callback that the ASP.NET runtime will invoke immediately before response headers are sent for this request.

AppendCookie(HttpCookie)

將 HTTP Cookie 加入至 HTTP 回應 Cookie 集合中。Adds an HTTP cookie to the HTTP response cookie collection.

AppendHeader(String, String)

將 HTTP 標頭加入至目前回應。Adds an HTTP header to the current response.

AppendToLog(String)

將自訂記錄資訊加入至網際網路資訊服務 (IIS) 記錄檔。Adds custom log information to the Internet Information Services (IIS) log file.

ApplyAppPathModifier(String)

如果工作階段使用 Cookieless 工作階段狀態,並傳回合併的路徑,則將工作階段 ID 加入虛擬路徑。Adds a session ID to the virtual path if the session is using Cookieless session state, and returns the combined path.

BeginFlush(AsyncCallback, Object)

將目前已緩衝的回應傳送到用戶端。Sends the currently buffered response to the client.

BinaryWrite(Byte[])

將二進位字元的字串寫入 HTTP 輸出資料流。Writes a string of binary characters to the HTTP output stream.

Clear()

從目前回應清除所有標頭和內容輸出。Clears all headers and content output from the current response.

ClearContent()

從目前回應清除所有內容。Clears all content from the current response.

ClearHeaders()

從目前回應清除所有標頭。Clears all headers from the current response.

Close()

關閉與用戶端的通訊端連接。Closes the socket connection to a client.

DisableKernelCache()

停用目前回應的核心快取處理。Disables kernel caching for the current response.

DisableUserCache()

停用這個回應的 IIS 使用者模式快取。Disables IIS user-mode caching for this response.

End()

將目前所有緩衝的輸出傳送到用戶端、停止執行所要求的處理序,並引發 EndRequest 事件。Sends all currently buffered output to the client, stops execution of the requested process, and raises the EndRequest event.

EndFlush(IAsyncResult)

完成非同步的清除作業。Completes an asynchronous flush operation.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Flush()

送出所有目前正在緩衝的輸出到用戶端。Sends all currently buffered output to the client.

FlushAsync()

以非同步方式將目前所緩衝的所輸出輸送到用戶端。Asynchronously sends all currently buffered output to the client.

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)
Pics(String)

將 HTTP PICS-Label 標頭附加至目前的回應。Appends an HTTP PICS-Label header to the current response.

PushPromise(String)

支援傳送推送 Promise 給 HTTP 2.0 用戶端的應用程式。Supports applications sending push promises to HTTP 2.0 clients. 如需詳細資訊,請參閱 HTTP/2 Specification Section 8.2:Server Push (HTTP/2 規格第 8.2 節:伺服器推送。For more information, see HTTP/2 Specification Section 8.2: Server Push.

PushPromise(String, String, NameValueCollection)

支援傳送推送 Promise 給 HTTP 2.0 用戶端的應用程式。Supports applications sending push promises to HTTP 2.0 clients. 如需詳細資訊,請參閱 HTTP/2 Specification Section 8.2:Server Push (HTTP/2 規格第 8.2 節:伺服器推送。For more information, see HTTP/2 Specification Section 8.2: Server Push.

Redirect(String)

將要求重新導向至指定的 URL。Redirects a request to the specified URL.

Redirect(String, Boolean)

將要求重新導向至指定的 URL,並且指定是否終止執行目前的處理序。Redirects a request to the specified URL and specifies whether execution of the current process should terminate.

RedirectPermanent(String)

永遠從要求的 URL 重新導向至指定的 URL。Performs a permanent redirect from the requested URL to the specified URL.

RedirectPermanent(String, Boolean)

永遠從要求的 URL 重新導向至指定的 URL,並提供完成回應的選項。Performs a permanent redirect from the requested URL to the specified URL, and provides the option to complete the response.

RedirectToRoute(Object)

使用路由參數值,將要求重新導向至新的 URL。Redirects the request to a new URL by using route parameter values.

RedirectToRoute(RouteValueDictionary)

使用路由參數值,將要求重新導向至新的 URL。Redirects the request to a new URL by using route parameter values.

RedirectToRoute(String)

使用路由名稱,將要求重新導向至新的 URL。Redirects the request to a new URL by using a route name.

RedirectToRoute(String, Object)

使用路由參數值及路由名稱,將要求重新導向至新的 URL。Redirects the request to a new URL by using route parameter values and a route name.

RedirectToRoute(String, RouteValueDictionary)

使用路由參數值及路由名稱,將要求重新導向至新的 URL。Redirects the request to a new URL by using route parameter values and a route name.

RedirectToRoutePermanent(Object)

使用路由參數值,執行從要求之 URL 至新的 URL 的永久重新導向。Performs a permanent redirection from the requested URL to a new URL by using route parameter values.

RedirectToRoutePermanent(RouteValueDictionary)

使用路由參數值,執行從要求之 URL 至新的 URL 的永久重新導向。Performs a permanent redirection from the requested URL to a new URL by using route parameter values.

RedirectToRoutePermanent(String)

使用路由名稱,執行永遠從要求的 URL 重新導向至新的 URL。Performs a permanent redirection from the requested URL to a new URL by using a route name.

RedirectToRoutePermanent(String, Object)

使用路由參數值以及對應到新 URL 的路由名稱,執行永遠從要求的 URL 重新導向至新的 URL。Performs a permanent redirection from the requested URL to a new URL by using the route parameter values and the name of the route that correspond to the new URL.

RedirectToRoutePermanent(String, RouteValueDictionary)

使用路由參數值及路由名稱,執行永遠從要求的 URL 重新導向至新的 URL。Performs a permanent redirection from the requested URL to a new URL by using route parameter values and a route name.

RemoveOutputCacheItem(String)

從快取移除與指定路徑關聯的所有快取項目。Removes from the cache all cached items that are associated with the specified path.

RemoveOutputCacheItem(String, String)

使用指定的輸出快取移除提供者,移除所有與指定路徑相關聯的輸出快取成品。Uses the specified output-cache provider to remove all output-cache artifacts that are associated with the specified path.

SetCookie(HttpCookie)

更新 Cookie 集合中的現有 Cookie。Updates an existing cookie in the cookie collection.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TransmitFile(String)

將指定的檔案寫入 HTTP 回應輸出資料流,而不在記憶體中緩衝。Writes the specified file to the HTTP response output stream, without buffering it in memory.

TransmitFile(String, Int64, Int64)

將檔案的指定部分寫入至 HTTP 回應輸出資料流,而不在記憶體中緩衝。Writes the specified part of a file to the HTTP response output stream, without buffering it in memory.

Write(Char)

將字元寫入 HTTP 回應輸出資料流。Writes a character to an HTTP response output stream.

Write(Char[], Int32, Int32)

將指定的字元陣列寫入 HTTP 回應輸出資料流。Writes the specified array of characters to the HTTP response output stream.

Write(Object)

將指定的物件寫入至 HTTP 回應資料流。Writes the specified object to the HTTP response stream.

Write(String)

將指定的字串寫入至 HTTP 回應輸出資料流。Writes the specified string to the HTTP response output stream.

WriteFile(IntPtr, Int64, Int64)

將指定的檔案寫入 HTTP 回應輸出資料流。Writes the specified file to the HTTP response output stream.

WriteFile(String)

將指定的檔案內容寫入至 HTTP 回應輸出資料流,做為檔案區塊。Writes the contents of the specified file to the HTTP response output stream as a file block.

WriteFile(String, Boolean)

將指定檔案的內容寫入 HTTP 回應輸出資料流,並指定是否將內容寫入為記憶體區塊。Writes the contents of the specified file to the HTTP response output stream and specifies whether the content is written as a memory block.

WriteFile(String, Int64, Int64)

將指定的檔案寫入 HTTP 回應輸出資料流。Writes the specified file to the HTTP response output stream.

WriteSubstitution(HttpResponseSubstitutionCallback)

將替代區塊插入至回應,以便為快取的輸出回應動態地產生區域。Inserts substitution blocks into the response, which enables dynamic generation of regions for cached output responses.

適用於