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 处理程序来处理特定的预定义任何的类型公共语言规范 (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.