Leveraging httpModules for Better ASP.NET Applications

Since Microsoft first introduced a web server, Internet Information Services (IIS), programmers could catch each request to the server with an ISAPI filter. ISAPI filters traditionally have not been a very easy task for most programmers to create. When ASP.NET was released, the concept of custom modules was introduced, which allowed .NET programmers to effectively create similar libraries that could effectively process each request much like an ISAPI filter.

Interesting note: ASP.NET is actually executed through an ISAPI filter in IIS 6.0 and earlier.

One difference between an ISAPI filter and an ASP.NET module is that ISAPI filters process every request made to the web server and an ASP.NET module only processes requests to the specified site and its virtual directories. An ISAPI filter can be configured to only process a particular domain, resource, and so on, but that is not done very often.

IIS 7 does allow custom httpModules to be registered at the server level. This is a great new feature that enables .NET programmers to easily program server-wide application features. ISAPI programming was never an easy task, even for seasoned programmers.

Introduction to httpModules

As mentioned, custom httpModules provide a way to intercept each request being processed by ASP.NET and alter the request or content being sent to the client or to do server-side processing based on the request itself. Modules are used to execute custom ...

Get Leveraging httpModules for Better ASP.NET Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.