Professional Active Server Pages 3.0 Y L F M Richard Anderson, Chris Blexrud, A Andrea Chiarelli, Daniel Denault, E Alex Homer, Dino Esposito, T Brian Francis, Matthew Gibbs, Bill Kropog, Craig McQueen, George Reilly, Simon Robinson, John Schenken, Dean Sonderegger, Dave Sussman Wrox Press Ltd. (cid:147) Professional Active Server Pages 3.0 © 1999 Wrox Press All rights reserved. No part of this book may be reproduced, stored in a retrieval system or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews. The author and publisher have made every effort in the preparation of this book to ensure the accuracy of the information. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, Wrox Press nor its dealers or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Published by Wrox Press Ltd. Arden House, 1102 Warwick Rd, Birmingham, B27 6BH Printed in USA ISBN 1-861002-6-10 Trademark Acknowledgements Wrox has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Wrox cannot guarantee the accuracy of this information. Credits Authors Project Manager Richard Anderson Sophie Edwards Chris Blexrud Andrea Chiarelli Technical Reviewers Daniel Denault Matt Bullock Alex Homer Chad DePue Dino Esposito Andrew Enfield Brian Francis Alexander Haneng Matthew Gibbs Robert Howard Bill Kropog Shawn Jackson Craig McQueen Jeff Johnson George Reilly Stephen Kaufman Simon Robinson Brad Kingsley John Schenken Ajoy Krishnamoorthy Dean Sonderegger Dave Navarro Dave Sussman Robert Oliver Matthew Reynolds Additional Material Ulrich Schwanitz Matthew Bortniker Steven Smith Charles Campbell Kevin Spencer James M. Conard Andrew Stopford Richard Harrison William Storey Keith Stanislaw Adwait Ullal Kent Tegels Design/Layout Managing Editor Tom Bartlett Chris Hindley Mark Burdett William Fallon Editors Jonathan Jones Craig A. Berry John McNulty Dan Maharry Lisa Stephenson Illustrations Adrian Young William Fallon Jonathan Jones Development Editor Liz Toy Cover Chris Morris Index Concept by Third Wave Andrew Criddle About the Authors Richard Anderson Richard Anderson is an established software developer who has worked with Microsoft technologies for nearly 10 years. He works for a small yet globally known software house in Peterborough (England), where he currently holds the position of "Research and Development Manager". What that means is that he plays with lots of great new technologies, and then tells people how they work, ensuring they are correctly understood and adopted correctly and successfully in new applications. He also writes applications too, and is responsible for mentoring and managing C++ and VB developers. Richard can be contacted via his private email account [email protected]. Chris Blexrud Chris Blexrud, MCSD, is a consultant for Born Information Services, Inc. (http://www.born.com), a Microsoft Solution Provider. Chris's main areas of expertise are in Microsoft technologies such as ASP, VB, COM/DCOM, MTS, COM+, and various BackOffice products. When Chris is not developing business solutions, he enjoys snowmobiling and hunting in northern Minnesota and spending time with family and friends. Chris can be reached at [email protected]. Andrea Chiarelli Andrea Chiarelli is an independent consultant with experience in software design and training. He holds a degree in Computer Science and a Master in Software Engineering, works for software companies and training centers in Tuscany (Italy) and is a regular contributor to Computer Programming, an Italian programming magazine. His experience spans from database design to multimedia software developing. In recent years he's specialized in designing Internet and Intranet systems developing Web-based applications and interfacing databases to the Web primarily using Active Server Pages technology. Daniel Denault Daniel Denault is a developer and network administrator developing Internet applications and doing high security network configuration designs and installations in the behavioral healthcare industry. Dan Denault is also an independant consultant. These applications are developed using the following technologies Customized ActiveX controls, ActiveX DLL's, Active Server Pages, Word and Excel OLE automation, JavaScript, VBScript, DHTML, IIS, and SQL Server 7.0. Daniel Denault can be contacted at [email protected]. Dino Esposito Dino is a free-lance consultant based in Rome, Italy. He specializes in scripting and COM development and worked for Andersen Consulting focusing on development of Web-based applications. He loves writing and is a contributing editor to Microsoft Internet Developer for which runs the Cutting Edge column. He regularly contributes also to Microsoft Systems Journal, MSDN News, Windows Developer's Journal. Get in touch with Dino at [email protected]. Brian Francis Brian Francis is the Technical Evangelist for NCR's Retail Self Service Solutions. From his office in Duluth, Georgia, Brian is responsible for enlightening NCR and their customers in the technologies and tools used for Self Service Applications. Brian also uses the tools he evangelizes in developing solutions for NCR's customers. He has worked extensively with Wrox Press as a technical reviewer and has also co- authored on a number of projects. Matthew Gibbs Matthew is currently working on Internet technologies at Microsoft and pursuing a graduate degree in computer science from the University of Washington. As always, he enjoys using C/C++, but has become a fan of the rapid development capabilities provided by ASP. At present, his studies are focused on database management systems, their design and use. In particular, he is interested in the potential for advancement in data mining techniques and technologies. Alex Homer Alex came to writing computer books through an unusual route, including tractor driver, warehouse manager, garden products buyer, glue sales specialist, and double-glazing salesman. With this wide-ranging commercial and practical background, and a love of anything that could be taken to pieces, computers were a natural progression. Now, when not writing books for Wrox, he spends his spare time sticking together bits of code for his wife's software company (Stonebroom Software - http://www.stonebroom.com) or just looking out of the window at the delightfully idyllic and rural surroundings of the Peak District in Derbyshire, England. Bill Kropog Bill Kropog is a full-time consultant for a Web and software development firm in New Orleans, Louisiana. Bill specializes in finding new and creative ways to display and manipulate data with Active Server Pages. He uses Visual InterDev 6.0 for most of what he develops, with frequent hops into Visual Basic 6.0. He also creates most of the graphics he uses in his projects (Corel Xara 2.0 and Adobe PhotoShop 5.0), making him a well-rounded developer. XML is the latest thing on Bill's plate, and, being a former journalist, he'd like to develop XML-based standards for online publications to make it easier to share news and to bring ordinary journalists into the online world. Craig McQueen Craig is a Principal Consultant at Sage Information Consultants, Inc. His role at Sage is to guide clients in their adoption of Internet technologies into their existing business. Recently, he led an e-commerce implementation of Site Server at a major consumer electronics company. Previous to consulting, Craig led the development of two small retail Internet products: InContext WebAnalyzer and InContent FlashSite. Craig has a Master of Science degree from the University of Toronto where he specialized in Human- Computer Interaction. George Reilly George V. Reilly has been a member of the IIS/ASP development team since shortly before ASP 1.0 shipped at the end of 1996. Nowadays he is responsible for IIS performance. He has been doing his best to write tight code since he discovered the BBC Micro in his native Dublin, Ireland in 1982. In retrospect, he has a hard time believing that he found enough time to co-write "Beginning ATL COM Programming", Wrox Press, 1998. Simon Robinson Simon Robinson lives in Lancaster, UK, where he shares a house with some students. He first encountered serious programming when doing his PhD in physics. He would program in FORTRAN when his supervisor was watching (physics lecturers like FORTRAN) and C when he wasn't. The experience of programming was enough to put him off computers for life, and he tried to pursue a career as a sports massage therapist instead until he realized how much money was in programming and wasn't in sports massage. He then spent a year writing some very good cardiac risk assessment software but he and his business partner never got round to selling it to anyone. Finally, driven by a strange lack of money, he looked for a—whisper the word quietly—job. Which somehow ended up—after a year of his working for Lucent Technologies in Welwyn Garden City—leading to him writing books about computers. You can visit Simon's web site at http://www.simonrobinson.com/ John Schenken John Schenken is currently Software Test Lead on the Visual Basic Server Enterprise Team for Microsoft. He was previously Test Lead for the Microsoft Script Debugger that shipped with Windows NT Option pack and is still responsible for it in Windows 2000. He has a computer science degree from Texas A & M university. He has programming experience involving MSMQ, SMTP, NT Event Log, NT Perf Counters, ASP, business objects and ADO (basically wide experience writing end-to-end web applications involving business objects). Dean Sonderegger Dean is responsible for the technology and development of products at Ultraprise Corporation based in Sterling, Virginia. He's worked with Active Server Pages since its inception and specializes in internet- based commercial application development. The majority of his spare time is spent chasing his two sons Crawford and Jordan, or with his lovely wife Karen. David Sussman David has spent most of his professional life as a developer, starting with Unix and C, in the days when the Internet was only used for Usenet newsgroups. He then switched to Microsoft development languages, and spent several years moaning about the lack of pointers in Visual Basic. Like Alex, he lives in a quiet, rural village, this time in Oxfordshire. He spends his spare time convincing himself that he'll get off his backside and get fit. He never does. Introduction They say that everyone can remember exactly where they were, and what they were doing, when one of those major events in history occurred. It could be when President Kennedy was shot, it could be the day that Elvis Presley died, or it could just be something less historic and much closer to home – such as the first time you saw 'Doom'. One of our colleagues firmly believes that the introduction of Microsoft's Active Server Pages (ASP) technology, or Denali as it was called then, was one such important event. He backs this up by remembering exactly what he was doing at the time. He'd just finished work on a book about Web database connectivity techniques, ending with the jewel-in-the-crown at that time — the Internet Database Connector (IDC). The rapid addition of an extra chapter before going to press, to cover this exciting new ASP technology, was the order of the day. In fact that single chapter was probably the reason for most of the book's sales, because suddenly every developer wanted to be 'into' ASP. All this sounds like it was a long time ago, and we have all become quite blasé about Active Server Pages and whole range of techniques that have built up around it. But (at the time of writing) this was less than three years ago. Yet here we are, with version 3.0 of ASP just released, and with a feature set, performance and capabilities that leave the original version 1.0 standing in the dust. What Is This Book About? This book is about Active Server Pages 3.0, as included with Windows 2000. However, because ASP is now a core part of so many Web-oriented features within Windows, this book covers a far wider area than just how ASP works. ASP is maturing all the time to encompass more integration with other Windows services and software, and so there are many other areas that impinge directly on the use and performance of ASP.