Active Server Pages

ASP - Learning by Example

Dr. Robert B. Mellor    See also .... DHTML XML Buy ASP book
ASP - FAQs ASP - Afterword

This book is aimed at becoming the standard text book for introductory courses on Active Server Pages programming. It contains 26 examples of ASP coding, with each followed by a detailed explanation. Theory, tips and new concepts are introduced "along the way", both in the body of the text as well as in the examples.

This book contains relevant aspects of Structured Query Language (SQL), MS-Access, Personal Web Server (PWS4) and programming ASP in both VBScript and JavaScript.

Experience shows quite clearly, that if you sit down at your PC and read/work through the book, you will be able to do most ASP programming within a few days.

For this work you will need a Web Server, either PWS4, which is available free from microsoft.com, or MS-Internet Information Server, which comes free with Windows 2000. Further explanations follow both in the appendices, as well as in web-links provided at the end.

An ASCII text editor is sufficient to write the code examples described in this book.

Contents

Learn Active Server Pages.
The author
Symbols and conventions
Disclaimer.
Development of the Internet and the need for integration.
Figure 1. The generations of web sites
Figure 2. Integration in the jump from having WWW as an advertizing medium, to having an e-business
Software compatibility
Client-side and Server-side scripting.
What is ASP?
Figure 3: What happens with an ASP file ?
Personal Web Server 4
Editing ASP files
Example A: Simple ASP-script
Example B: Execution order in ASP scripts.
Conditional expressions
Example C: A dynamic ASP-side.
Concatination
Example D: Concatinated variables in strings.
Variables
Example E: Writing variables to HTML code and using integer (whole number) variables.
Overview: Types of variables
Overview: Types of operators
Starting Forms
Example F: Writing information into a form field, recovering it again with Request.Form and printing it to the browser with Response.Write.
The ASP Object Model
Branching
Example G: Using nested IF statements (one inside the other) with AND to check if several criteria are true.
Example H: Mixing IF and SELECT
Example I: Using FOR NEXT to make a variable with changing value and insert that into HTML.
Example J: Writing all the elements in the collection "server variables"
Validating a Form Submission
Example K: In this script variables are declared using Dim and Option Explicit and used to check the content of a text string.
Changing variable types
Example L: Changing variables from text to numbers and back again.
Conversion with JavaScript
Example M: Calling a JavaScript function from VBScript and using it for server-side variable conversion
Sending variables between files
Example N: In this example we create two files. In the first (.htm) file the data is typed in then sent via a FORM to a second (.asp) file.
The Form Methods POST and GET
Home Exercise 1: This should take you a whole day
Arrays
Example O: A simple array
Home Exercise 2: This should take you a whole day
Cookies
Example P: In the following example we write information to a cookie
Applications and Sessions
A password-protected log on side.
Example Q: Log on using session variables and an included (.inc) file.
Debugging
Option Explicit
Structured code and comments
Variable names
Response.Write (and debug.inc)
On Error Resume Next
ASP and databases.
Setting up an ODBC - Open Data Base Connectivity - Connection
Example R1: Using DSN to show the content of a database in HTML.
Example R2: Searching a database without DSN - using a DSN-less connection
Widening your search with the SQL joker sign %
Example S: Inserting data into a database using Request.Form and INSERT.
Example T: Removing data from a database using the URL method and Request.QueryString.
Example U: Updating a database.
Example V: Retrieving data from several tables using JOIN.
Example W: How to find out how many rows there are in a database - returning variables
Resume of some useful commands in SQL - Structured Query Language
File System Object Log-file
Example X: Visitor data, who are they and what platform are they using ?
Example Y: A visitor counter, an introduction to Constants.
Proceedures
Functions.
SubProceedures
Example Z: Use of Proceedures.
Appendix A
Extending ASP over the borders of MS Internet Information Server
Appendix B:
The Object Model:
Objects:
The Object Model, a graphical overview
Request object: Collections, Properties & Methods
Collection
Properties
Methods
Response object: Collection, Properties & Methods
Collection
Properties
Methods
Application Objects
Methods
Events
String Constants
String Functions
Date/Time Functions
Further information on the Net
Standard Sources & Info
Other Interesting Sites



Return to overview