IHttpHandler IHttpHandler IHttpHandler IHttpHandler Interface


定義 ASP.NET 使用自訂 HTTP 處理常式所實作的合約,以同步處理 HTTP Web 要求。Defines the contract that ASP.NET implements to synchronously process HTTP Web requests using custom HTTP handlers.

public interface class IHttpHandler
public interface IHttpHandler
type IHttpHandler = interface
Public Interface IHttpHandler


您可以撰寫自訂的 HTTP 處理常式來處理特定的預先定義的任何 Common Language Specification (CLS) 標準的語言中的 HTTP 要求的類型。You can write custom HTTP handlers to process specific, predefined types of HTTP requests in any Common Language Specification (CLS) compliant language. 可執行程式碼中定義HttpHandler類別,而不是傳統的 ASP 或 ASP.NET Web 網頁,這些特定的要求回應。Executable code defined in the HttpHandler classes, rather than conventional ASP or ASP.NET Web pages, responds to these specific requests. HTTP 處理常式提供您一種低層級的要求和回應服務的 IIS Web 伺服器互動,以及大部分 ISAPI 擴充程式類似,但使用簡單的程式設計模型提供的功能。HTTP handlers give you a means of interacting with the low-level request and response services of the IIS Web server and provide functionality much like ISAPI extensions but with a simpler programming model.

如果您的處理常式會存取工作階段狀態的值,就必須實作IRequiresSessionState介面 (未包含方法的標記介面)。If your handler will access session state values, it must implement the IRequiresSessionState interface (a marker interface with no methods).


IsReusable IsReusable IsReusable IsReusable

取得值,指出另一個要求是否可以使用 IHttpHandler 執行個體。Gets a value indicating whether another request can use the IHttpHandler instance.


ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext) ProcessRequest(HttpContext)

以實作 IHttpHandler 介面的自訂 HttpHandler 來啟用 HTTP Web 要求的處理。Enables processing of HTTP Web requests by a custom HttpHandler that implements the IHttpHandler interface.