ISAPI (Internet Server Application Programming Interface) filter

Internet Server Application Programming Interface (ISAPI) is an API developed to provide the application developers with a powerful way to extend the functionality of Internet Information Server (IIS). ISAPI filters always run on an IIS server, filtering every request until they find one they need to process. The ability to examine and modify both incoming and outgoing streams of data makes ISAPI filters powerful and flexible.

Developing a CGI(Common Gateway Interface) program involves creating an EXE with C, C++, and/or Perl programming languages. This EXE file will be executed and terminated for every request received, causing an excessive memory usage, whenever users hit the same page over and over again!

This excessive memory usage that could bring the server completely down, has been solved under ISAPI extensions. An ISAPI extension is a regular DLL file that exposes 3 special functions that is called by the calling process (i.e., IIS) and therefore, will be loaded to memory once, no matter how many clients are going to use it at the same time.

Since the ISAPI extension and the calling process (IIS) live at the same address space, they could contact each other, directly. This means a great potential to bring the whole IIS down, and in some cases, the entire web server! Take a look at the following figure:

Both ISAPI filters and ISAPI extensions can only be developed using C/C++. Visual Studio comes with wizards that make ISAPI development fast and easy.

Uses of ISAPI filters

ISAPI filters can be registered with IIS to modify the behavior of a server. Filters can perform the following tasks:

Change request data (URLs or headers) sent by the client.
Control the user name and password used with anonymous or basic authentication.
Modify or analyze a request after authentication is complete.
Perform custom authentication.
Handle encryption and compression.

NOTE: ISAPI filters DLLs cannot be requested explicitly, like ISAPI extensions can.

References :
http://msdn.microsoft.com/en-us/library/ms524610.aspx
http://www.codeproject.com/KB/ISAPI/isapi_extensions.aspx