CGI and ISAPI

The Common Gateway Interface is one method that a Web browser can use to run an application on your server. You can write a CGI application in a script and run it through a Perl interpreter; or you can compile the application in C/C++.

Windows NT Server relies on ISAPI instead of CGI as a method to efficiently request information from other applications. Unlike CGI, an ISAPI application exists as a dynamic-link library rather than an executable program. The ISAPI DLL is a communication pipe between Internet Information Server and an Internet service. The WWW service loads ISAPI DLLs when needed.

An ISAPI application can also take advantage of the Win32 API and the Open Database Connectivity (ODBC) standard. An ISAPI application provides better performance because it takes advantage of memory pointers and does not have to be restarted to process new data requests.

If multiple clients request dynamic content that can be supplied by one ISAPI DLL, then the WWW service loads the DLL only once. It unloads the DLL from memory if it goes unused for a long period. The advantage to loading an ISAPI DLL once is that the DLL is loaded in the WWW service process, and the Web server's performance improves when it does not have to switch among multiple processes. The Web server also does not need to create and destroy new processes.

When loaded, the ISAPI DLL code is part of the WWW service and the ISAPI application then acts as an extension.

The Internet Information Server works with two types of ISAPI DLLs:

ISAPI applications are add-ons that permit dynamic content generation and, when requested, explicit content generation. Explicit pages reside on a Web server; dynamic pages are not assembled until the client requests them. For more information, see Chapter 9, "Monitoring Dynamic Page Generation."

ISAPI filters add themselves to the path between the client and the server. An ISAPI filter modifies or monitors all input and output and is able to change the behavior of the server. (See Figure 1.4.)

Figure 1.4 The ISAPI filter can provide an additional security barrier