6 July 2011

HTTP Modules in asp.net

HTTP Modules in asp.net

An HTTP module is an assembly that is called on every request made to your application.
HTTP modules are called as part of the ASP.NET request pipeline and have access to
life cycle events throughout the request.
HTTP modules therefore give you the opportunity to examine incoming and outgoing requests
and take action based on the request.

Typical uses for HTTP modules include:

Security.
-Because you can examine incoming requests, your HTTP module can perform custom
authentication or other security checks before the requested page, XML Web service,
or handler is called.

Statistics and logging.
-Because HTTP modules are called on every request, you can gather request statistics and
logging information in a centralized module, rather than in individual pages.

Custom headers or footers.
-Because you can modify the outbound response, you can inject content such as custom header
information into every page or XML Web service response.

HTTP Modules vs Global.asax Files

-You can implement much of the functionality of a module in the application's Global.asax
file, which enables you to respond to application events.

-However, modules have an advantage over the Global.asax file in that they are encapsulated
and can be created once and used in many different applications.

-By adding them to the Global Assembly Cache (GAC) and registering them in the Machine.config file, you can reuse them across applications.



1 comment:

Comments Welcome