In the dim and distant past, web developers wishing to create more than just static displays of information turned to CGI (Common Gateway Interface) and Perl to introduce some sort of interaction to their pages. While this approach worked (and indeed, many sites still use it today), CGI was not by any means fast and the quest for an alternative means to create a page dynamically continued. ISAPI came and went primarily because it required more knowledge to create a dynamic filter than web programmers were prepared to learn. Finally came web scripting languages and with them Microsoft's Active Server Pages: a server-side scripting technology for building web pages that are both dynamic and interactive.
An Active Server Page itself is simply a text file script with the extension .asp containing HTML, client- and server-side script. The implementation behind the ASP page was created by Microsoft and intended as an open technology server-side framework, giving web developers the freedom to develop dynamic web sites using information accessed from the many COM-compliant data sources available to them.
The syntax and grammar of ASP is easy to comprehend, and yet powerful enough to:
support some interaction between page user and server
allow web page access to databases and directory services
incorporate and make use of high-powered COM components
It's also server-based, and therefore browser-independent, leaving you only the problems of which cross-browser client-side script and stylesheet you want to use.
Writing ASP pages is straightforward:
The static content of the page is created using HTML and text. We can also use standard HTML forms to question the client and, using ASP, create a page that incorporates their answers into the text. This is the simplest form of client-server interactivity using ASP.
We make calls to one or several of the ASP intrinsic objects to create the dynamic element of the page. ASP provides a set of intrinsic objects Response, Request, Application, Server and Session that allow us to access information about the request being made of the server, as well as the response that the server will send.
Finally, we can incorporate any standard COM object (or active server component, as we call them) into a page. There are many third-party companies who specialize in writing such components and if you do use them, then you have the added guarantee that they've been stress-tested and fully debugged. On the other hand, if you need your component to do something unique, COM components are easy to develop in any established language. Visual Studio would be a good investment at this point.
So now that we know what ASP is, where can I get an ASP scripting engine from?
ASP is a web enhancement tool that was developed and distributed by Microsoft. As such, the ASP scripting host (which translates ASP into HTML) is distributed within Microsoft's web-specific products its web servers, Internet Information Server (IIS) and Personal Web Server (PWS) and its HTML editors (FrontPage 9x and Visual Interdev, though not Notepad ;-). In the spirit of the open standard that ASP wants to be, the scripting host has also been taken by third parties and rewritten for use with other, non-Microsoft web servers more on that later.
To date, there have been two versions of ASP for development use. The first, ASP 1.0, appeared in 1996 with Windows NT4 Service Pack 3 as part of IIS 3.0. ASP 2.0 reared its head about nine months later, much improving on its previous incarnation it is this version which is available for installation with a web server/html editor from quite a few sources. The latest version, ASP 3.0, is due to ship some time in the first half of 1999 with IIS 5.0 (as part of Windows 2000. Since ASP 3.0 is currently not widely available (and is still in beta), we'll concentrate on ASP 2.0 in this book, which you can install from the following sources.
Contrary to its rather specific name, the Windows NT 4.0 Option Pack comes in two different flavors (the choice depends on which operating system you are using). If your system set-up is based upon Windows 95 or Windows NT 4 Workstation, then ASP will be installed with Personal Web Server. If you use Windows NT 4 Server, then ASP is installed with Internet Information Server.
The Option Pack is available from several different sources:
MSDN subscribers will find it on Disk 2 of the BackOffice Test Platform or
Disk 13 of the Development Platform.
Other users can download it from the Microsoft home site at http://www.microsoft.com/ntserver/nts/downloads/recommended/NT4OptPk/default.asp. The total pack is 27Mb, so be prepared for a long wait and no, there isn't an option to download just IIS and ASP.
The Windows 98 Install Disk includes a version of Personal Web Server and ASP as an extra to the operating system itself. Simply run setup.exe from the add-ons/pws directory of the disk and all will be well.
Windows NT4.0 can be a tricky beast to set up, and getting the latest version of ASP running with the latest hotfixes for security holes and other bugs can be a matter of trial and error unless you know the right order in which to install your software. For an NT 4.0 web server running ASP, it would be preferable to get a copy of the NT 4.0 Option Pack and then install in this order:
Windows NT 4.0 Server/Workstation
NT 4.0 Service Pack 3
Internet Explorer 4.01 (or later)
NT 4.0 Option Pack (or other source of ASP)
NT 4.0 Service Pack 4
Service Pack 3 is required to install the Option Pack, but in its turn the Option Pack contains older files than SP4 which contains the latest hotfixes (upto November 1998 anyway). Check out the Microsoft security or downloads sites for the fixes after SP4 (see Appendix H for URLs).
If you've installed Internet Information Server, there's a couple of other things you need to do in order to make sure ASP is running and will run in your test code. Checking that ASP has been installed properly is simplicity itself. IIS documentation comes installed as a set of .asp files you can test your ASP installation simply by choosing to run those help files from the Start menu (at Programs | NT 4.0 Option Pack | Product Documentation). If the help files display correctly, then ASP is running. If they don't, then it isn't.
The other quick check to make is to ensure that the virtual root for your web site is set up to run .asp files. In the MMC, expand the IIS folder and select either a web site or a virtual directory beneath it. Bring up the Properties dialog for that virtual directory by right-clicking on it and selecting Properties from the menu that appears. Select the Documents tab, add Default.asp to the default documents listbox and promote it above Default.htm using the arrows on the right-hand side.
Finally, click on the Home Directory tab (this will be the Virtual Directory tab if you are setting the properties of a virtual directory instead of a web site). Under the Permissions heading at the bottom of the dialog, make sure the Script radio button is checked this ensures the ASP scripting host will parse the page when it is requested by a client.
This applies to IIS4.0 only. In IIS3.0 the Script button doesn't exist, so you have to select the Execute button. It was only when IIS3.0 was being used in production setups, that anyone noticed that selecting Execute allows any executable file to be run in that directory which imposed a security threat on the website . Thus, in IIS4.0 the Script button appears in the Permissions dialog to allow only the 'secure' execution of scripts in the relevant directory.
Personal Web Server is really just a scaled down version of Internet Information Server and to ensure that ASP is running correctly and is available for your site, the checks are the same. The PWS documentation can be run from the Start menu under Programs | Personal Web Server | Product Documentation to confirm that ASP is running, and once you have created a virtual directory for your web site, the default document dialog can be found in the Advanced Options window of PWS.
Meanwhile, the Scripts permission button can be found by selecting Edit Properties. Again, make sure that Scripts is checked along with Read.
The core of ASP is the ASP Scripting Host, which you can find in asp.dll without it, we would have no working .asp files. However, although the vast majority of ASP developers are currently using either Personal Web Server or Internet Information Server to base their pages on, these web servers are no longer the only products that contain a productive ASP engine for us to work with.
The really attractive part of having open standards even wannabe ones like ASP for the Internet is that once a standard has been released, it can be implemented by anyone. Soon after Microsoft's release of ASP 1.0, a company called Chili!Soft began to develop a fully-functional parser for other web servers besides IIS and PWS.
On the Windows NT platform, Netscape's Enterprise and Fasttrack servers are now ASP-enabled thanks to their product Chili!ASP, as are Lotus' Domino and Go Webservers. A version for NT Apache is currently in beta. Chili!ASP also offers ASP and ADO to Netscape servers on the Sun Solaris platform and has plans in the works for more non-PC-based servers too. It will be interesting to see how Chili!soft react to the release of ASP 3.0. The question of whether or not they'll upgrade their current products is pressing, but whatever the answer there, ASP is no longer just for IIS.