Walkthrough: Creating and Registering a Custom HTTP Module
2021-03-21 20:28
标签:ali handlers ice topic href nali add mod led This walkthrough illustrates the basic functionality of a custom HTTP module. An HTTP module is called on every request in response to the BeginRequest and EndRequest events. As a result, the module runs before and after a request is processed. If the ASP.NET application is running under IIS 6.0, you can use HTTP modules to customize requests for resources that are serviced by ASP.NET. This includes ASP.NET Web pages (.aspx files), Web services (.asmx files), ASP.NET handlers (.ashx files), and any file types that you have mapped to ASP.NET. If the ASP.NET application is running under IIS 7.0, you can use HTTP modules to customize requests for any resources that are served by IIS. This includes not just ASP.NET resources, but HTML files (.htm or .html files), graphics files, and so on. For more information, see ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0 and ASP.NET Application Life Cycle Overview for IIS 7.0. The example module in this topic adds a message to the requested ASP.NET Web page at the beginning of any HTTP request. It adds another message after the page has been processed. The module includes code that makes sure that it does not add text to a request for any other file type. Each event handler is written as a private method of the module. When the registered events are raised, ASP.NET calls the appropriate handler in the module, which writes information to the ASP.NET Web page. Tasks illustrated in this walkthrough include the following: How to create the code for an HTTP module. How to register the module in the Web.config file. In order to complete this walkthrough, you will need: The walkthrough also assumes that you are working with IIS 6.0 or IIS 7.0. However, you can see the functionality of the module even if you run the ASP.NET Development Server. Walkthrough: Creating and Registering a Custom HTTP Module 标签:ali handlers ice topic href nali add mod led 原文地址:https://www.cnblogs.com/chucklu/p/12720072.htmlWalkthrough: Creating and Registering a Custom HTTP Module
Prequisites
文章标题:Walkthrough: Creating and Registering a Custom HTTP Module
文章链接:http://soscw.com/index.php/essay/67306.html