Monday, 25 July 2011

Differnce HttpModule , HttpHandler , HttpApplication??

HttpModule is a simple class implementing IHttpModule interface. This interface provides initialization and disposal events. Initialization is used to attache handlers to events which integrated pipeline raises (these are all the events that are exposed by the HttpApplication object – as BeginRequest and EndRequest), enabling HttpModule to work in IIS 7.0 Integrated mode.

HttpHandler requires (this is the one difference) to be mapped to a particular file extension – established through the web.config file - and needs an entry point to get into the handler’s code. This entry point is the HTTP endpoint – actually the last stop for the incoming Http requests – and is the other difference.

HttpApplication is a class implementing IHttpAsyncHandler and IHttpHandler (and another two) and is used as a base class for applications (most of the time as a base class of the Global class in Global.asax file). HttpApplication class are instantiated in the ASP.NET infrastructure and is not supposed to be created by the user directly.