Learning ISAPI

Dr. Dobb's Journal March 1998

By Jeff Cromwell

Jeff is a software engineer for Levi, Ray, and Shoup Inc. in St. Louis, Missouri. He can be contacted at jcromwell@lrs.com.

Using ISAPI
Stephen Genusa, Bobby, Jr. Addison, Allen Clark, Dean Cleaver
Que Education and Training, 1997
590 pp., $49.99
ISBN 0-789-70913-9

Professional Visual C++ ISAPI Programming
Michael Tracy
Wrox Press Inc., 1996
273 pp., $40.00
ISBN 1-874-41666-4

Programming ISAPI with Visual Basic 5
Wayne S. Freeze and Tim Ritchie
Prima Publishing, 1997
468 pp., $40.00
ISBN 0-761-50914-3

One test for any "how to" book is the author's ability to convey information in such a manner that you can easily digest difficult material and transfer that knowledge to solve your own software-development problems. Although a single book is not a panacea to what ails software developers, books do serve as important instruments in the building of the mental tools that all programmers need and desire. One such tool that I needed was the ability to interface a database, server, and web site on Windows NT 4.0. Although many technologies exist to do this, my situation demanded the use of the Microsoft Internet Server Application Interface (ISAPI) to communicate between these applications. In addition to this, I wanted the ability to develop programs that can manipulate data from the traffic of my company web site. Technically, I wanted to perform filter control of the site.

Being unfamiliar with ISAPI, I turned to the three books examined here to get the essential tools to accomplish the task. The first, designated as the most complete reference, is entitled Using ISAPI, and written by Stephen Genusa et al. The other two books are more specific and deal with the subject matter in the confines of a specific language. For example, Michael Tracy's Professional Visual C++ ISAPI Programming and ISAPI with Visual Basic 5, by Wayne S. Freeze and Tim Ritchie are self explanatory. I'll first examine the general book by Genusa, then move on to the other two.

Using ISAPI

Using ISAPI, by Stephen Genusa et al., is readable and delivers on its promise to teach you what the API is, how it can best be used, and to provide a reference. It is broken down in typical ISAPI fashion: You first proceed through brief tutorials on the Web, NT, and ISAPI. Next comes a discussion on the pros and cons of ISAPI usage versus CGI, and an introduction into the meat of the book -- including a substantial discussion on ISAPI extensions and filters. The book concludes with advanced topics with respect to debugging and threading.

Using ISAPI provides an excellent treatment on filters and includes a well-developed tutorial that monitors the HTTP communication event process. Considerable space is devoted to the issue of the information flow in the filter as well as ISAPI filter rules. Some of the ISAPI filter applications that can port to a real-world setting are the custom authentication and logging filters. The authors provide an excellent treatment of these applications, which, at times, can be demanding from a technical standpoint.

While Using ISAPI provides a detailed treatment of individual topics mixed with a seminal application in both C++ and Visual Basic, I found it limiting: Reference books tend to be unsuitable for quickly transmitting an author's knowledge to solve a reader's specific problems. The book's breadth and richness take considerable time to digest. I would say that it is a necessary addition to my ISAPI library, and that the Que books are technically sound. However, they often require considerable effort to follow along and understand. The sample applications ("Hello World" and "guestbook") do provide some quick instructional coding examples. Still, most of the work is focused on a discussion of the API and associated parameters. This is necessary, of course, for reference, but it hinders readability and consistency. If you have time to generate sample programs and learn overall conceptual development, and you desire to know the intricacies of ISAPI programming, you need this book. Otherwise, do not expect to use this book right away to solve specific problems like interfacing databases to web applications.

Programming ISAPI with Visual Basic 5

Moving from the general to the specific, Programming ISAPI with Visual Basic 5, by Wayne S. Freeze and Tim Ritchie, delivers on the promise of showing you how to effectively program the ISAPI and efficiently use ActiveX controls in the development of web pages. Freeze and Ritchie build an integrated example application called "WebMaster," which provides information on important groupware concepts such as mail, discussions, and calendaring. While it is entirely a "how-to" book, it does offer good referential treatment of the OLE ISAPI 2 interface. If you are new to the OLE ISAPI 2 interface, this book demonstrates how to use a Visual Basic program with a web server as an ISAPI extension. The rationale behind this is to allow the creation of server-side ActiveX applications for Microsoft's Internet Information Server (IIS). Freeze and Ritchie quickly state some of the limitations of using OLEISAPI2, which (as mentioned before) does not let you write ISAPI filters or allow multiple thread activity. The authors go over the basics of objects, properties, and methods; and the remainder of the book is devoted to the WebMaster application, which is similar to applications like Lotus Notes and Microsoft Exchange.

While there are many potential problems with an integrated application approach to code instruction, the authors do an excellent job of remaining consistent throughout the book and adhering to their approach. The time and effort you will put into the coding example will give you the feeling of accomplishment, and their systematic code instruction (along with sample screen snapshots) lets you replicate their work easily. If you are seeking a solution to a particular problem, however, the book's approach is at times impractical.

If you have the time, Programming ISAPI with Visual Basic 5 is an excellent book. The author's code is well designed with both substantial and suitable comments that provide considerable aid in the learning process. The main drawback of the book has more to do with the OLE ISAPI than with the author's work. However, if you find that going through the code of an entire application is the best way you learn interface concepts, then this is a necessary item for your bookshelf.

Professional Visual C++ ISAPI Programming

Michael Tracy's Professional Visual C++ ISAPI Programming promises to teach you how to program real-world, industrial-strength ISAPI extensions, and it delivers. For example, I was able to take the content provided in Chapter 4; code, test, and adapt it to meet my needs; while, at the same time, learning the concepts. The book is not a reference, but Tracy provides invaluable tips and strategies within the context of the application development. Although it is half the size of the other two books, Professional Visual C++ ISAPI Programming provides immediate access to easily extend the author's sample code. The section on e-mailing form data not only teaches you the API, but also provides a strategy for those engaged in sockets programming. I admit my partiality to C++, but no matter what the language, Professional Visual C++ ISAPI Programming easily conveys difficult concepts in the code. In addition, the sample ISAPI debugger included with the book is great, and I have used it successfully in debugging my own ISAPI extensions. Tracy provides the complete source code, so you can dwell deeper into substantive issues about ISAPI programming. One drawback is that the book can be, at times, terse, but this is probably due to the writing style of the author and the length of the book.

I found the treatment on the multithreading issues, coupled with Tracy's illustration on the pitfalls of synchronized threading in ISAPI, extremely important. Tracy does not provide a detailed treatment of thread-synchronization objects (such as critical sections, mutexes, semaphores, and events), but does provide the necessary details to use these in the context of database application writing. In the context of the ISAPI filter, he develops the same User Authentication alluded to in Using ISAPI. However, emphasis on both the cache manager and the ODBC API provide considerable insight, and the ready-to-use code can easily be implemented in current development projects.

This book does presume that you have some well-developed tools already at your disposal (knowledge of both Microsoft's Internet Information Server and MFC, for instance). If you want to build applications through real-world examples in Visual C++ with ISAPI, then this is the book for you.

Conclusion

All three books would be good additions to the ISAPI programmer's resource toolkit. Apart from the CD-ROMs that come with two of the books (Genusa and Freeze books), each book fulfills a different need. Genusa's book provides an overall reference work with a complete description of ISAPI, along with some tutorials illustrated in both Visual Basic and Visual C++. Its main drawback is that it is a typical reference book, and must be utilized in that way. The other two books are quintessential "how-to" books: Freeze relies on using the integrated application approach to convey VB and ISAPI programming; while Tracy demonstrates the use of VC++ with ISAPI in the context of real-world applications. Both teach you about the necessary tools within their respective contexts.

DDJ


Copyright © 1998, Dr. Dobb's Journal