Active Server Pages
ASP - Learning by Example
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.
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.
Learn Active Server Pages.
Symbols and conventions
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
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.
Example C: A dynamic ASP-side.
Example D: Concatinated variables in strings.
Example E: Writing variables to HTML code and using integer (whole number) variables.
Overview: Types of variables
Overview: Types of operators
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
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.
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
Example O: A simple array
Home Exercise 2: This should take you a whole day
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.
Structured code and comments
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.
Example Z: Use of Proceedures.
Extending ASP over the borders of MS Internet Information Server
The Object Model:
The Object Model, a graphical overview
Request object: Collections, Properties & Methods
Response object: Collection, Properties & Methods
Further information on the Net
Standard Sources & Info
Other Interesting Sites
Return to overview