ISAPI and Forms

This sample demonstrates how ISAPI extensions can access the data provided by an HTML form. The code for this sample has been subdivided into several different files. The main file, FORMDUMP.CPP, implements the DLL entry-point function DllMain, as well as the ISAPI extension entry-point functions GetExtensionVersion and TerminateExtension.

The entry-point function HttpExtensionProc is also provided in FORMDUMP.CPP, and the bulk of the flow-control for the extension is performed in this function. When HttpExtensionProc is invoked, the extension sends an HTTP response header to the client browser. The extension then parses the inbound form fields, and sends information about each of those form fields to the client, as well. The extension next calls the WhoAmI function, implemented using the Windows NT LookupAccountSid function, to determine the security context in which the client browser is running. Finally, SendVariables is used to send an HTML list of some of the more important server variables and values.

The other key file in this project, KEYS.CPP, provides an interface that you can use to access the form data that is passed to the extension with either the GET or POST method. The function GetKeyList is called first, to create a linked list of key-value pairs. GetKeyInfo is then used to walk through the linked list, and access information about each key in the list.

A third project file, HTML.CPP, provides a series of reusable wrappers for the most common HTML tasks. For instance, the function HtmlCreatePage can be used to write the beginnings of an HTML page, including the <HTML>, <TITLE>, and <BODY> tags, to the client browser.

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\formdump subdirectory of the Internet services directory.


© 1997 by Microsoft Corporation. All rights reserved.