Tuesday, June 06, 2006

Karl Seguin: HttpHandlers – Learn Them. Use Them.

Itt van a teljes cikk.

Why use a handler?
First and foremost, HttpHandlers are far more reusable/portable than pages.
Secondly, the Page handler is relatively expensive… if you do that in a page you’ll end up raising a number of events (onInit, onLoad, onPreRender, onUnload, …) and make use of a number of ASP.NET features such as viewstate and postback. In most cases, the performance hit is negligible, but it nonetheless highlights that you’re using the page framework when you have no need to.

Why not to use HttpHandlers?
The biggest and very significant drawback of HttpHandlers is that they can only be used for extensions that are mapped to ASP.NET in IIS.