Introduction
This book is about Active Server Pages 3.0, as included with Windows 2000. Active Server Pages (ASP) is a powerful server-based technology from Microsoft, designed to create dynamic and interactive HTML pages for your World Wide Web site, or corporate intranet.
This book teaches ASP and script-based programming from the ground up. It will answer the fundamental questions:
- What exactly is ASP?
- How do I get up and running with ASP?
- How does it work?
- How can I use it to produce dynamic, interactive web applications?
We'll answer these questions in a thorough and comprehensive way, with plenty of complete working examples. So even if you're absolutely new to this technology, you will gain a deep understanding of what ASP is really about and how you can harness it to build powerful web applications.
The introduction of ASP was a milestone in the development of dynamic, interactive and scalable web applications and it has matured a great deal since its inception. ASP is now considered an integral part of working with Windows on the Internet. So, as well as giving a thorough grounding in the fundamentals of ASP, this book will cover all of the new developments and will show you how ASP integrates with the latest versions of exciting new technologies such ADO, COM+ and XML.
This book will help you to learn how to use ASP effectively to handle and transfer the information that you need for your web page. The aim of this book is to get you producing compelling, practical web applications with intelligent, dynamic pages.
Who is this Book For?
This is a Wrox Beginning… series book, so we will aim to teach you everything you need to know from scratch. We appreciate that most, if not all, of the web page authors and developers who take up Active Server Pages will be reasonably familiar with ordinary HTML; therefore, we won't spend any time teaching you HTML. If you don't know HTML, then we suggest that you take a little time to get yourself familiar with HTML before attempting to learn about Active Server Pages. There are plenty of good HTML tutorials on the market.
There are two kinds of beginners for whom this is the ideal book:
- You're a beginner to programming and you've chosen ASP as the place to start. Great choice! Active Server Pages is easy, it's fun and it's also powerful. This book will hold your hand throughout.
- You can program in another language but you're a beginner to web programming. Again, great choice! Come in from the cold world of Visual Basic or whatever language you use, and enjoy. This book will teach you how ASP does things in terms you'll understand.
Most of all, you don't need to know anything more than the basic ins and outs of how to put your own web page together. If you've never written a single line of any programming language, then you have to nothing fear – this is the book for you. The bottom line is that this book will teach you how to write ASP programs.
What Does This Book Cover?
Conceptually, this book breaks down into seven sections, which cover a whole range of ASP-related topics. Hopefully we've done this in a logical and orderly fashion that will allow you to fully understand how ASP works, what it can do for you and how it integrates with surrounding technologies.
Chapters 1 and 2 lay the foundation for everything that follows in the book. You'll find out how to set yourself up to use ASP 3.0, and then we'll dive into the fundamentals of ASP and web pages. Once we've covered the ASP basics, we move on to consider web servers – how they interpret ASP and how they communicate with web browsers. You won't be doing too much programming in these initial chapters – we focus on providing the background information that is vital to you obtaining a through understanding of what ASP is about.
Chapters 3–5 build on the basic concepts learned in the first two chapters; these three chapters represent our first serious look at ASP code. We start with simple, practical examples in which we create dynamic web pages using ASP. We'll find out how to pass information from a browser to ASP, and back from ASP to the browser. We then take a look behind the scenes to find out how these examples work. In the process, we'll see how ASP stores data, and look at the control structures that allow us to perform more complex tasks with ASP.
Chapter 6–11 are all about objects. We start with a general introduction to objects and the properties, methods and events that allow us to retrieve information from them and get them to perform tasks for us. After introducing all of the objects in the ASP object model and covering their basic functionality, we delve deeper into specific objects. We start with the Response and Request objects, which allow us to encapsulate information and pass it between the browser and server. The we move on to discuss the flexibility added to this process by the Application object, the Session object and cookies – which allow us to organise our Active Server Pages into a powerful web-based application. Chapter 9 covers useful error handling and debugging techniques, with particular reference to the ASPError object, which is new to ASP 3.0 and greatly improves the error-handling process. In Chapter 10 we tackle Scripting Objects – a set of objects normally available in client-side VBScript as well as ASP. These allow us to store, view, manipulate and retrieve information from text files on the server. In Chapter 11 we enter the world of components – pre-packaged software objects that provide webmasters with complex and re-usable functionality for their ASP applications. We see how we can create instances of these components in ASP, using the Server object, and look at the functionality provided by several such components.
Chapters 12–14 are essentially about ActiveX Data Objects (ADO), how we can incorporate these objects in our ASP pages, and how we use them to access all sorts of data from various types of data stores. We start with a general discussion of data access issues, and then investigate one particular type of data store – the database. We'll find out how to form a connection between the ASP page and the database, and how we retrieve and store the information contained within. Finally, we cover some objects that are new to ADO 2.5, and which allow us access to a vast array of different types of data.
Chapter 15 is a big one! It puts into practice everything we have learned in the first fourteen chapters. We spend the whole of this chapter building a working ASP application for advertising and selling items on the web.
Chapters 16 and 17 take us back into the realm of components. You will find out about the Windows Script Components, which allow us to create COM objects from script and use them with our ASP applications. We consider the use of these components in multi-user applications, and introduce the concept of transactions. You'll meet a new and exciting technology called COM+, which provides an excellent framework for managing scalable, transactional ASP applications.
Chapter 18 introduces Extensible Markup Language (XML) – a self-describing markup language that has revolutionized the way in which we can transfer data and share it between applications. Chapter 18 gives you a whirlwind introduction to this technology and shows you how you can use XML with your ASP applications.
The Appendices provide useful reference material covering such areas as the ASP and ADO objects & models, the VBScript language and commonly-used terminology.
What Do I Need To Use This Book?
Basically, what you need is a copy of Active Server Pages 3.0 and a web server for your platform! But let's take a slightly more scientific approach than that, by looking at the requirements in more detail:
- In order to complete all of the examples in this book (and in particular those demonstrating the latest developments in ASP 3.0), you will need a machine with Windows 2000 installed. Internet Information Server and all of the associated services that you will need for this book are included with Windows 2000 Professional (which replaces Windows NT Workstation).
If you are using Windows 2000 Professional, you should aim for a machine with at least a 233MHz processor. You can get away with 64MB of RAM, though 128MB is ideal.
- You will need a web server that supports ASP 3.0. The Windows 2000 operating system comes with Internet Information Server 5.0 (IIS 5.0) but you need to make sure that it is actually installed on your machine. We will show you how to do this in Chapter 1.
- You will need a web browser in order to view your pages. Predominantly, we used Internet Explorer 5.0 (IE5), but any browser will do.
There are also some non-Microsoft platforms that you can use – we will cover these options in Chapter 1. However, the book concentrates on ASP 3.0 running on Internet Information Services version 5 and Windows 2000 Professional.
ASP Development Tools
We're not going to provide any tutoring on how to use any of the development tools so it's best to use whichever you're most comfortable with. Probably the most obvious development tool for working with ASP is Microsoft's own Visual Studio package; or just Visual InterDev (one of the components of Visual Studio) on its own. Visual InterDev, especially in the latest version, provides a whole range of editing, debugging and code building tools. There are also many 'wizards' that are designed to help you get the job done more quickly.
If you are a hardened keyboard hacker, and you don't like anything to get in the way of writing code your way, you might prefer to use a simple text editor to create ASP pages instead. You can even build them using a pure HTML page creation tool (such as Microsoft FrontPage), and then insert your ASP script afterwards. The old favorite ASP tool, Windows Notepad, will do quite nicely.
Conventions
We have used a number of different styles of text and layout in the book to help differentiate between the different kinds of information. Here are examples of the styles we use and an explanation of what they mean:
Try It Outs – How Do They Work?
1. Each step has a number.
2. Follow the steps through, and get the example running.
3. Then read 'How It Works' to find out what's going on.
Advice, hints and background information comes in an indented, italicized font like this.
Important bits of information that you really shouldn't ignore come in boxes like this!
Bulleted lists appear indented, with each new bullet marked as follows:
- Important Words are in a bold type font.
- Words that appear on the screen in menus like the File or Window menu are in a similar font to what you see on screen.
- Keys that you press on the keyboard, like Ctrl and Enter, are in italics.
Active Server Pages code has two fonts. If it's a word that we're talking about in the text, for example, when discussing the For...Next loop, it's in a bold font. If it's a block of code that you can type in as a program and run, then it's also in a gray box:
Private Sub cmdQuit_Click()
End
End Sub
Sometimes you'll see code in a mixture of styles, like this:
Private Sub cmdQuit_Click()
End
End Sub
In this case, we want you to consider the code with the gray background. The code with a white background is code we've already looked at, and that we don't wish to examine further.
Also you'll see that most of the code in Beginning Active Server Pages 3.0 is either HTML tags, server-side script (ASP) or client-side script. In spite of it being recommended in the HTML 4.0 standard that tags should be specified in lower case, for ease of reading we have chosen to display HTML tags in upper case throughout the book and all script in lower case. Server-side script is usually surrounded by <% and %> marks. So an example might look like this:
<BODY>
<H1>This is some HTML </H1>
<SCRIPT LANGUAGE=VBScript>
obj1 = "This is some VBScript."
<% obj2 = "This is some ASP." %>
</SCRIPT>
</BODY>
These formats are designed to make sure that you know what it is you're looking at. I hope they make life easier.
Customer Support
We've tried to make this book as accurate and enjoyable as possible, but what really matters is what the book actually does for you. Please let us know your views, either by returning the reply card in the back of the book, or by contacting us via e-mail through http://www.wrox.com/WileyCDA/Section/id-105124.html.
Downloading the Source Code
As you work through the examples in this book, you might decide that you prefer to type all the code in by hand. Many readers prefer this because it's a good way to get familiar with the coding techniques that are being used.
Since you are using this version of the book online though, it's also easy to copy and past the code from the examples into your editor. And we have made all the source code and files you'll need for some examples for this book available at our web site, at the following address:
http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764543636,descCd-download_code.html
If you're one of those readers who likes to type in the code, you can use our files to check the results you should be getting – they should be your first stop if you think you might have typed in an error. If you're one of those readers who doesn't like typing, then downloading the source code from our web site is a must!
Either way, it'll help you with updates and debugging.
Exercises
At the Wrox website you will also find additional exercises for each chapter (along with the solutions). It is highly recommended that you work through these examples. This book will give you the knowledge you need – but it is only through practice that you will hone your skills and get a true feel for what ASP can help you achieve. These are also available on the code download page .
Errata
We've made every effort to make sure that there are no errors in the text or the code. However, to err is human and as such we recognize the need to keep you informed of any mistakes as they're spotted and corrected. Errata sheets are available for the printed edition of this book at http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764543636,descCd-view_errata.html. If you find an error that hasn't already been reported, please let us know. But here in this wiki version of the book, we've done our best to fix all of the known errors from the printed book online. If you think you have found an additional error while reading the wiki pages for the book, register to join the ASP3wiki and leave a comment with the error on the affected page.
Our web site acts as a focus for other information and support, including the code from all our books, sample chapters, previews of forthcoming titles, and articles and opinion on related topics.
p2p.wrox.com
Wrox has a totally comprehensive and unique support system. Wrox has a commitment to supporting you not just while you read the book, but once you start developing applications as well. We provide you with a forum where you can put your questions to the authors, reviewers and fellow industry professionals.
At http://p2p.wrox.com you'll several different discussion forums suited to different needs:
- Beginning ASP 3.0: This is the active discussion forum specifically for this book. Ask questions there about the book
- Classic ASP Beginners: This is our discussion forum for beginners about ASP 3 issues not directly related to the book. If you have a question about something you are working with in ASP 3 that isn't about the book, try asking in this forum. (ASP 3 is sometimes referred to as "classic" ASP as this is the version that predates the current ".NET" versions.)
- HTML Code Clinic: Separate your HTML questions from your ASP questions and use this forum for HTML issues.
- Beginning ASP: This was the original discussion are for the book for the first few years after it published
- ASP Web HowTo: This was a question and answer forum for specific questions about how to accomplish a task with ASP
- ASP Webserver: This archived discussion was about the web servers used with ASP (primarily IIS 5 and 5.1)

RSS

