The ASP.NET Flow and HTTPModule
When the request gets sent to the
HTTPApplication object, it then gets sent to any HTTPModules that
are registered in the web.config file of the application.
There are already HTTPModules in
ASP.NET that are a part of every application. These include authentication,
authorization and session state modules and if you've ever handled the
Session_Start or Session_End events in global.asax then you have
used these modules (specifically the session state module).
Why use an HTTPModule
HTTPModules can take the request and
do anything to it before a Page object is created and used. For
example, if you only wanted people using Netscape to access your pages, then
you could write an HTTPModule that executed before a Page was
created to block other browsers. You could also use it to monitor performance
counters or calculate the elapsed time for a request.
What is an HTTPModule
An HTTPModule qualifies as anything
that implements the IHTTPModule interface. The interface only has two
methods -
Public Interface
IHttpModule
Public Sub Dispose()
Public Sub Init(context as HttpApplication)
End Interface |