IHttpHandler 介面


定義 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 網頁, 會回應這些特定的要求。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).



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



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