Chapter 1
Preface


Active Server Pages (ASP) allows for powerful web application development. It is
both simple to use and, with its extensibility through ActiveX and Java components,
very powerful. But what is it? Is it a programming language? No, not exactly.
Is it a Microsoft-only rapid development platform? No, not really.
Active Server Pages is a technology originally created by Microsoft as an answer to
the sometimes complex problems posed by CGI application development. It
allows you to use any scripting language, from VBScript to Python, to create realworld
web applications.
Although originally only available for Microsoft platforms, ASP is quickly becoming
available for nearly any web server on many operating systems. Microsoft suggests
that there are 250,000 web developers using ASP and over 25,000 web applications
built using ASP. So you’re not alone.
You hold in your hands the desktop reference for this exciting technology.
Who Is This Book For?
This book is intended as a reference guide for developers who write Active Server
Page web applications. Whether you are a professional developer paid to work
magic with the Web or an amateur trying to figure out this web development
thing, this book is for you. If you are coming to ASP from CGI, I hope this book
will help make your transition from CGI to ASP an easy one.
I hope this book will be a very accessible, very convenient reference book. While
I was writing this book, I envisioned myself (or one of you) with half a line of
code written, trying to remember what options were available for the specific
property or method I was attempting to use. I wanted a quick access book that
would sit on my desk and be there when I needed it. I hope I have achieved that
goal.


xii

Preface


How to Use This Book
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
This book is not for the beginning programmer that knows nothing about the
Web. There are already several books out there that will teach you about web
applications and even how to write ASP applications specifically. Although each
chapter starts with a brief overview, I have included these sections only to put the
current object for that chapter in the context of Active Server Pages as a whole.
How to Use This Book
As mentioned above, this book is a reference. Although you can read the entire
book from beginning to end and understand Active Server Pages from a holistic
perspective, that was not my intent. There are two ways to use this book:
• You can navigate to the particular chapter that covers the intrinsic ASP object
or component in which you’re interested. This method of navigating the book
will help you learn more about the intrinsic object or component with which
you are working.
• You can look up the particular method, property, or event with which you’re
working and go directly to the explanation and example code that you need.
Each chapter is divided into sections to help make reference simple. Each section
covers a specific topic related to the intrinsic ASP object or component that is the
focus of that chapter. The sections are:
Introduction
This section introduces the object or component in the context of its use in
ASP applications.
Summary
This section lists the object or component’s properties, methods, collections,
and events. Note that not all of these elements are present for every object or
component.
Comments/Troubleshooting
This section contains my comments on experiences I have had with the
specific object or component. It is here that I will talk about possible discrepancies
between Microsoft’s documentation and my experience.
Properties
This section covers all the properties and their uses of the specific object or
component.
Collections
This section covers all the collections for the specific object or component.
Methods
This section covers all the methods for the specific object or component.
Events
This section covers all the events for the specific object or component. (Note
that most objects and components don’t support any events.)
Each Properties, Collections, Methods, and Events section is further divided into an
introduction, an example, and comments.


Preface xiii


Preface
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
How This Book Is Structured
ASP in a Nutshell is divided into three parts. Part I, Introduction to
Active Server Pages, provides a fast-paced introduction to ASP that consists of three
chapters. Chapter 1, Active Server Pages: An Introduction, places ASP within the
broader context of the evolution of web application development, provides a
quick example Active Server Page, and briefly examines the ASP object model.
Chapter 2, Active Server Pages: Server-Side Scripting, examines the difference
between client-side scripting and server-side scripting, takes a look at the structure
and syntax of ASP pages, and examines the scripting languages that can be
used for ASP development. Chapter 3, Extending Active Server Pages, examines the
general mechanism for incorporating external COM components into an ASP application
and lists the components that are included with Internet Information Server
(IIS).
In part, Active Server Pages is an object model that features six intrinsic objects
(Application, ObjectContext, Request, Response, Server, and Session) that are
always available to your scripts. (Actually, the ObjectContext object is a Microsoft
Transaction Server object that is available only if you’re using ASP 2.0 or greater.)
Part II, Object Reference, documents each of these intrinsic objects. These chapters
are arranged alphabetically by object. In addition, Chapter 10, Preprocessing Directives,
Server-Side Includes, and GLOBAL.ASA, covers three major structural features
of ASP that are not closely related to its object model.
ASP is extensible. That is, by calling the Server object’s CreateObject method, you
can instantiate external COM components that can be accessed programmatically
just like any of the six intrinsic objects. Part III, Installable Component Reference,
documents the components that are included with the IIS installation. These
eleven chapters are again arranged alphabetically by component name.
Finally, ASP in a Nutshell includes three appendixes. Appendix A, Converting CGI/
WinCGI Applications into ASP Applications, shows what’s involved in converting a
simple application from Perl and Visual Basic to ASP and VBScript. It also includes
two handy tables that list CGI and WinCGI environment variables and their equivalent
ASP properties. Appendix B, ASP on Alternative Platforms, examines some of
the beta and released software that will allow you to develop ASP applications for
software other than Microsoft’s. Finally, Appendix C, Configuration of ASP Applications
on IIS, covers the configuration details that you need to know about to get
your ASP application to run successfully.
Conventions Used in This Book
Throughout this book, we’ve used the following typographic conventions:
Constant width
Constant width in body text indicates an HTML tag or attribute, a scripting
language construct (like For or Set), an intrinsic or user-defined constant, or
an expression (like dElapTime = Timer()-dStartTime). Code fragments
and code examples appear exclusively in constant-width text. In syntax statements
and prototypes, text in constant width indicates such language
elements as the method or property name and any invariable elements
xiv Preface
How to Contact Us
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
required by the syntax. Constant width is also used for operators, statements,
and code fragments.
Constant width italic
Constant width italic in body text indicates parameter and variable names. In
syntax statements or prototypes, constant width italic indicates replaceable
parameters.
Italic
Italicized words in the text indicate intrinsic or user-defined functions and
procedure names. Many system elements, such as paths, filenames, and URLs,
are also italicized. Finally, italics are used to denote a term that’s used for the
first time.
This symbol indicates a tip.
This symbol indicates a warning.
How to Contact Us
We have tested and verified all the information in this book to the best of our
ability, but you may find that features have changed (or even that we have made
mistakes). Please let us know about any errors you find, as well as your suggestions
for future editions, by writing to:
O’Reilly & Associates, Inc.
101 Morris Street
Sebastopol, CA 95472
1-800-998-9938 (in the U.S. or Canada)
1-707-829-0515 (international/local)
1-707-829-0104 (fax)
You can also send messages electronically. To be put on our mailing list or to
request a catalog, send email to:
nuts@oreilly.com
To ask technical questions or comment on the book, send email to:
bookquestions@oreilly.com


Preface xv


Preface
ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
We have a web site for the book, where we’ll list examples, errata, and any plans
for future editions. You can access this page at:
http://www.oreilly.com/catalog/aspnut/
For more information about this book and others, see the O’Reilly web site:
http://www.oreilly.com
Acknowledgments
I’d like to start by thanking my wife, Liticia, without whose support this book
would not have been written.
Next, I’d like to thank Ron Petrusha, my editor at O’Reilly. His comments and
thoughtful insights have helped to make this book what it is. Also, if it weren’t for
the tireless efforts of his assistant editors, Tara McGoldrick and Katie Gardner, this
book may not have been completed on time. Thank you.
I’d also like to personally thank Tim O’Reilly for not only publishing some of the
best books in the industry, but also for going one step further and publishing
several titles meant to “give back” to the community. How many technical
publishers would produce the best computer documentation in the industry,
support free software efforts worldwide, and still make time to publish books like
Childhood Leukemia. Very few. Thank you, Tim.
I’d like to thank my technical reviewers, Chris Coffey, John Ternent, Matt Sargent,
and Sarah Ferris. Their efforts and professional comments helped keep me focused
on creating a quick reference that’s useful to real-world, professional ASP developers.
I’d like to especially thank Chris for helping me to focus on the details and
maintain a high level of consistency.
I’d like to note my gratitude to Chris Burdett, Karen Monks, Chad Dorn, Chris
Luse, and Jeff Adkisson at the technical documentation department at my last
employer. Their contributions to the skills required to write this book were early
but imperative.
Finally, I’d like to thank you for buying this book and for using it. I hope it helps
you get home a little earlier or get a little more done in your day.

ASP in a Nutshell: A Desktop Quick Reference, eMatter Edition
Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved.
PART I
Introduction to
Active Server Pages
This part contains a brief introduction to Active Server Pages and an overview
of the interaction between Active Server Pages and Microsoft’s
Internet Information Server. Also in this part, you will be introduced to the
IIS object model and the objects that make it up and to all the installable
server components that come with IIS. Part I consists of the following
chapters:
Chapter 1, Active Server Pages: An Introduction
Chapter 2, Active Server Pages: Server-Side Scripting
Chapter 3, Extending Active Server Pages