ASP-view component


This project contains an example program that is a demonstration of a WWW server-side Automation component using the Microsoft Active Server Pages (ASP) protocols. It also demonstrates the use of type libraries in a Dylan project.

The OLE-Automation library used by this program is documented in the Functional Developer "OLE, COM, ActiveX and DBMS" reference manual.

Web Server configuration

In order to use this example, you must have a Web server that supports Active Server Pages, such as Windows NT Internet Information Server (IIS), or a Microsoft personal Web server. Make sure to install the Active Server Pages component of the Web server by downloading any additional Setup programs needed.

Once you have a server installed, copy the file asp-view.asp from this project's source directory to a directory used by the server (e.g. to c:\inetpub\wwwroot or c:\wwwroot\).

Project configuration

This project uses the Automation type library defined by the Web server. Before you can compile the project, you must update it to know the location of the type library on your system:

  1. First, find your Web server's asp.dll file. Typically it will be in c:\windows\system\inetsrv\asp.dll or c:\winnt\system32\inetsrv\asp.dll. If you cannot access the Web server files directly from your development machine, just put a copy of asp.dll anywhere where it will be accessible -- the file is only used to extract type information, it will not be actually executed by this project.
  2. In the Sources tab of the Project window, open the file asp-type-library.spec (the last file in the project) by double-clicking on it.
  3. Edit the "Type-library:" line to contain the actual location of the asp.dll file.

You can now build the component, e.g. by pressing the "Build" button in the Project window.

Component registration

In order for the component to work when started by the Web server, all of the libraries used by the component need to either be in the same directory as the component, or else in a directory which is in the system PATH (not the individual user's PATH on NT). The simplest way to accomplish this is to use the "Project > Build Release" command to create a release directory. If you wish, you can move that directory to any location you want, but you must do so before you attempt to register the component. If your Web server is on a different machine than the project, you must copy the release directory to the Web server's machine and register it there, since this is a server-side component.

To register the component, use the regsvr32 command line utility like this:

regsvr32 asp-view.dll

(The complete pathname will need to be given if the file is in a different directory that is not in the PATH.) This will cause the appropriate entries to be made in the Windows System Registry. (For use in a batch script, the "/s" option may be used to suppress the dialog box reporting completion.) The full pathname of the server is recorded, so you must unregister the server before you move or delete it. You can unregister it by doing:

regsvr32 /u asp-view.dll

This invokes the server to unregister itself, so won't work if the server has been deleted first.

Usage

To test out the component, use any browser to connect to your Web server, and ask it to load the asp-view.asp file. E.g. if you installed asp-view.asp in the server's top-level wwwroot directory, and the browser is running on the same host as the server, the url would look like this: http://localserver/asp-view.asp

The resulting page will give you the option of viewing different aspects of the Active Server Pages environment, such as the values of all server variables or the session id. The asp-view component is invoked to compute and display the requested information back on the page.