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

前端 未结 6 853
清酒与你
清酒与你 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:17

    Both handlers and modules can only really be understood in the context of the ASP.NET pipeline model and how a custom handler/module you create will fit into that model.

    Couple of good resources here and here.

    As others have mentioned modules can be used to create behaviour at certain event points (another common use is global exception handling), handlers create endpoint request handling (it's not just a clever name) where an asp.net page instance (which ultimately is just a heavily wrapped up handler anyway) would be either unnecessarily heavy or outright wrong. Personally I use any time I'm creating something which doesn't output HTML, which gets more and more common the more you develop web-apps as opposed to web-sites.

提交回复
热议问题