Table Of ContentSummary of Contents
Introduction 1
Chapter 1: Introducing ASP 5
Chapter 2: Decision Making, Loops, and Arrays 35
Chapter 3: Functions 67
Chapter 4: Objects, Properties, Methods, and Events 97
Chapter 5: Error Handling 127
Chapter 6: Extending Dreamweaver MX 145
Chapter 7: Advanced ASP Databases 169
Chapter 8: File Handling 193
Chapter 9: Using XML with ASP 219
Chapter 10: Sessions and Cookies 243
Chapter 11: Integrating Flash MX and ASP 261
Case Study 1 : A Simple Slogging System 291
Case Study 2: Message Forum 317
Index 357
Dreamweaver MX: Advanced ASP Web
Development
Edward Apostol
Omar Elbaga
Dan Short
Rob Turnbull
© 2003 Apress
Originally published by glasshaus in 2003
ISBN 978-1-59059-195-6 ISBN 978-1-4302-5498-0 (eBook)
DOI 10.1007/978-1-4302-5498-0
Dreamweaver MX: Advanced ASP Web
Development
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 authors 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, glasshaus 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.
~shaus
© 2003 Apress
Originally published by glasshaus in 2003
Trademark Acknowledgements
glasshaus has endeavored to provide trademark information about all the companies and products
mentioned in this book by the appropriate use of capitals. However, glasshaus cannot guarantee the
accuracy of this information.
Credits
Authors Lead Technical Editor
Edward Apostol Chris Mills
Omar Elbaga
Dan Short Technical Editors
Rob Turnbull Alessandro Ansa
Matt Machell
Technical Reviewers Mark Waterhouse
Kapil Apshankar
Bryan Ashcraft Publisher
Midhun James Viv Emery
Allan Kent
Drew McLellan Project Managers
Murray Summers Helen Cuthill
Sophie Edwards
Proof Reader
Agnes Wiggers Graphic Editors
Rachel Taylor
Indexer Pip Wonson
Bill Johncocks
Production Assistants
Commissioning Editor Paul Grove
Simon Mackie Tina Ramwell
Brand Visionary Cover
Bruce Lawson Dawn Chellingworth
Cover Image
The cover image of this book was created by Don Synstelien of http://www.synfonts.com, co-author of
the glasshaus book Usability: The Site Speaks For Itself. You can find more of Dan's illustration work
online at http://www.synstelien.com.
About the Authors
Edward Apostol
Edward Apostol is a man of many hats, playing the role of Internet
Consultant, Developer, and Instructor in E-Commerce, Wireless, and
New Media Studies. Edward has been a cornerstone in the Toronto web
design community, being one of the first instructors to be involved with
and teach Internet development in Canada since 1997.
Edward has been involved in many projects, including work for Compaq
Corporation and Lotus Corporation. His work has been featured in many
industry magazines such as Create Online, and web sites such as
Macromedia.com. Edward has also spoken at numerous conferences in
North America on a wide variety of web development topics. Edward's
recent accomplishments include sharing a prestigious London
International Advertising Award for best in New Media (self-promotional
category), for the site http://www.shawnsfolkart.com.
His thoughts, reflections and web experiments can be found at http://www.edapostol.com. Edward is
currently also associated with onX Enterprise Solutions (http://www.onx.com ) as well as Centennial
College (http://www.bccc.com) in Toronto.
I would like to acknowledge and thank first and foremost the love of my life, Marilyn,
for supporting me through my crazy work lifestyle; my parents and my brother
Michael, for just "being there"; Chris Mills and the folks of glasshaus Publishing, who
make this effort possible; and thanks to my many current and former students, as well
as my colleagues and friends, who help push me to new limits of technical innovation.
Omar Elbaga
Starting out as a fine artist, Omar Elbaga gradually moved to computer
graphic arts. He was particularly amazed by the power of the World Wide
Web, so he embarked upon building small-scale sites for fun utilizing
HTML and his art background. Falling in love with designing web pages
and its potential, he began a career in web design. Omar has since been
in the web development field for several years. With his head in computer
books nearly 24 hours a day, Omar moved on to enhance his skills from
web design to web programming.
Most of his work involves building database-driven web sites for small
companies. Omar is currently a Tutorial Manager for udzone.com and
runs a popular Dreamweaver MX resource site named udnewbie.com.
Having had the opportunity to study the Arabic language abroad for several months in an intensive
course at the Fajr Center in Cairo, Omar is also a translator who translates mostly 12th century scholarly
Arabic manuscripts into English. Omar is currently a senior at New Jersey City University completing a
double major in English Literature and Secondary Education.
Dan Short
Daniel Short never planned to be a Web designer, it just happened. He
started out in the Army tearing apart computers and eventually began
putting together web sites. Dan is a devoted Macromedian (and Team
Macromedia Volunteer) and uses almost the entire Macromedia Web
Design Suite, including Fireworks and Macromedia Flash. He's been
doing the Web gig since the end of 1998, and has had great luck building
his web design business through Web Shorts Site Design. Dan helps to
maintain several HTML and Dreamweaver reference sites including
dwfaq.com, for which he created the style changer and all ASP
functionality, including the Snippets Exchange and the DWfaq/Store.
He's also written articles for several resource sites, including
AListApart.com and the Macromedia Designer and Developer Center,
http://www.macromedia.com/desdev.
He is also a contributing author to the Dreamweaver MX Bible from Hungry Minds and Dreamweaver
MX Magic from New Riders.
Rob Turnbull
Rob Turnbull is the senior developer for Lighthouse; an established new
media Design Company based in Shrewsbury, UK. Clients across Europe
from small businesses to blue chip companies provide an increasing
workload, which includes the development of databases, web sites,
multimedia presentations, interactive CO-ROMs, promotional videos and
30 artwork in both animated and still form.
His personal Web site, http://www.robgt.com, is primarily focused on
offering help and guidance to fellow Dreamweaver and UltraDev users
including tutorials and links to helpful resources and some useful
extensions.
My thanks go to the. invisible team working just as hard behind the scenes that
actually get a book like this published; you guys have been great to work with.
Perhaps more importantly, my thanks, my gratitude and my respect go to Sarah. Your
care and support have been fantastic and /look forward to seeing you in the daylight
hours again!
Introduction 1
What's It All About? ..........................................................................................1
Who's This Book for? ........................................................................................1
What Do I Need to Begin? ................................................................................2
What's Inside? ..................................................................................................2
Support and Feedback ......................................................................................3
Web Support ..................................................................................................................3
Chapter 1: Introducing ASP 5
Go Dynamic with ASP ......................................................................................6
Familiarize Yourself with ASP Basics ..............................................................7
ASP Delimiters <o/o ... 0/o> .............................................................................................. ?
Response.Write ............................................................................................................9
The <0/o= Shortcut ...................................................................................................... 10
Commenting Code ...................................................................................................... 11
VBScript Basics ..............................................................................................1 4
Working with Variables ....................................................................................1 4
So Why Dim Variables? .............................................................................................. 15
Outputting Variables ....................................................................................................1 5
Variable Scope? ..........................................................................................................1 6
Data Types ........................................................................................................1 7
lnteger. .........................................................................................................................1 7
String ..........................................................................................................................1 8
Boolean ........................................................................................................................2 0
An Aside: Finding Out a Variable's Data Type ............................................................2 1
Date ............................................................................................................................2 1
Empty and Null ............................................................................................................2 2
Naming Your Variables ................................................................................................2 3
VBScri pt Operators ........................................................................................2 5
Comparison Operators ................................................................................................2 5
Logical Operators ........................................................................................................2 6
Arithmetic Operators ....................................................................................................2 8
Operator Precedence ......................................................................................3 1
Summary ..........................................................................................................3 3
Chapte on Making, d Arrays 35
Decision-Making Process ..............................................................................3 5
If ... Then ... Else, Else If ............................................................................................3 6
Select Case ................................................................................................................3 9
Looping Through Code ..................................................................................4 1
While ... Wend ............................................................................................................4 1
Do While/Until ... Loop ................................................................................................4 3
ii