Simple ISAPI Extension

This sample demonstrates how easily you can create your own ISAPI extensions, and even though this particular example is quite simple, the general form of an extension is the same, no matter how complex.

This sample demonstrates several entry-point functions that all ISAPI extensions must expose to IIS. The first entry-point function needed, GetExtensionVersion, is called by IIS when the DLL is first loaded into memory. This function, as demonstrated in this example, simply provides IIS with a brief description of the extension, along with some version information.

The main entry-point function, HttpExtensionProc, forms the core, or at least the gateway to the core, of an ISAPI extension. IIS calls this method after processing the version and descriptive information gathered using the previous method, and passes to the extension one parameter, a pointer to an Extension Control Block (ECB).

In this sample, HttpExtensionProc uses the ECB pointer provided by IIS to access the WriteClient call-back function, which is supplied with the ECB structure. Notice that the last parameter for WriteClient indicates that the writes to the client browser are to be performed synchronously. WriteClient is called multiple times, creating a simple HTML page, and HttpExtensionProc returns a success code to the server and caller. The connection with the client browser is then terminated.

This sample is provided for educational purposes only. It has not been tested in a production environment, and Microsoft® will not provide technical support for it.

This project is available in the ...\iissamples\sdk\isapi\extensions\simple subdirectory of the Internet services directory.


© 1997 by Microsoft Corporation. All rights reserved.