iis - 何时编写处理程序或模块.. 任何示例?

标签 iis httphandler httpmodule

我已经阅读了这些内容,但仍然对我将编写 http 处理程序而不是 http 模块(反之亦然)的用例感到困惑。每个用例的一些示例将有所帮助

最佳答案

HTTP Handlers and HTTP Modules Overview

Typical uses for custom HTTP handlers include the following:

  • RSS feeds To create an RSS feed for a Web site, you can create a handler that emits RSS-formatted XML. You can then bind a file name extension such as .rss to the custom handler. When users send a request to your site that ends in .rss, ASP.NET calls your handler to process the request.

  • Image server If you want a Web application to serve images in a variety of sizes, you can write a custom handler to resize images and then send them to the user as the handler's response.

Typical uses for HTTP modules include the following:

  • Security Because you can examine incoming requests, an HTTP module can perform custom authentication or other security checks before the requested page, XML Web service, or handler is called. In Internet Information Services (IIS) 7.0 running in Integrated mode, you can extend forms authentication to all content types in an application.

  • Statistics and logging Because HTTP modules are called on every request, you can gather request statistics and log information in a centralized module, instead of in individual pages.

  • Custom headers or footers Because you can modify the outgoing response, you can insert content such as custom header information into every page or XML Web service response.

关于iis - 何时编写处理程序或模块.. 任何示例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4833254/

相关文章:

c# - 用于集成测试的 stub 网络服务器

angularjs - angular.service 调用错误:net::ERR_INSECURE_RESPONSE

iis - 创建 IIS 网站的代码

c# - ASP.Net 异步 HTTP 文件上传处理程序

asp.net - 使用默认命名空间的 HttpHandler

c# - 如何从内部代码生成 IIS machineKey?

c# - 如何在 javascript 中捕获 .net httphandler 的异常?

asp.net - 'runAllManagedModulesForAllRequests' 设置为 'true' 时的静态压缩

asp.net - 加密和解密 FormsAuthenticationTicket 以验证用户身份

asp.net - 使用自定义 http 模块时,IIS 7 中默认页面的 AJAX 部分呈现问题