有关HTTP Handlers And Moudles

来源:互联网 发布:淘宝买的组装机好不好 编辑:程序博客网 时间:2024/05/16 19:05

I'm reading《ASP.NET Unleashed , Second Edition》now 。I estreat some word about Http Handlers and Modules.

Using HTTP Handlers And Moudles.

Both HTTP handlers and modules enable you to gain low-level access to HTTP requests and responses.

Working with HTTP Handlers

An HTTP handler enables you to handle all requests made for a file with a certain extension, path, or request type. You can use HTTP handlers to handle requests for ASP.NET pages or any other file type, such as image or text files.

Typical uses for handlers include implementations of custom authentication schemes and custom filters. For example, you can create a handler that authenticates requests for image files. Or you can create a handler that automatically transfers requests for one file to another file.

Working with HTTP Modules

An HTTP module is similar to a handler in that it enables you to gain low-level access to the HTTP requests and responses processed by the ASP.NET framework. However, an HTTP module, unlike a handler, enables you to participate in the processing of every request.

The ASP.NET framework includes several standard modules for managing state and implementing authentication schemes. For example, the output cache, session state, forms authentication, and Windows authentication are all implemented as modules.

原创粉丝点击