httpmodules httphandlers, whats the ideal use of them? when to use and when not to use?

前端 未结 6 914
清酒与你
清酒与你 2021-02-04 13:36

I have some questions about httpmodules and httphandlers, i am a little confused of the real need of them, i created many websites, but rarely used them, sure i lost a benefit f

6条回答
  •  自闭症患者
    2021-02-04 14:18

    HttpHandlers are great for re-routing requests for certain file types and other resources. For example, when you need to do something with an incoming request for a file type that ASP.NET doesn't protect via FormsAuthentication, you can actually determine if it is a particular file type, located in a specific directory and redirect the user to another page if not authorized.

    HttpModules can perform specific processing for your app in a resource-independent fashion. A more technical explanation can be found here: http://www.15seconds.com/issue/020417.htm

    Also, they do add overhead to each request, which means you shouldn't use them for process-intensive tasks.

提交回复
热议问题