PersonalASP Version 2 - User Guide


A guide to installing, developing and testing PersonalASP based applications.


Contents


Introduction

Active Server Pages (ASP) technology has provided an excellent environment for developers to rapidly create stable, feature rich, data driven browser-based applications. PersonalASP allows applications to be developed in the same way for local execution on the PC, without the need for a local web server to be installed and without changing any Internet Explorer configuration.


Download and Install

The PersonalASP evaluation version is available from the ModeZero web site at www.ModeZero.net/PersonalASP. The code is fully functional and not time limited, so developers can explore its full capabilities in their own time.

To install:

Simply download and run the install application from the PersonalASP web site.


The ModeZero Application Domain

The pre-installed ModeZero domain home page contains a brief description of PersonalASP and links to 3 sections described below:

Licence Information

This page displays all the currently installed licences, along with their state (valid, invalid etc).

VBScript Samples

This is a root page with links to a number of samples that demonstrate key features of PersonalASP support. Each sample explains briefly what it demonstrates and a link is provided to view the source of the page.

Jscript Samples

New in Version 2 is support for the JScript language. As with VBScript, the root page contains links to pages demonstrating key JScript features.


What are Application Domains ?

All PersonalASP URLs have the following structure: pasp://<application-domain>/<page-path>

Where the application domain is between the double slash and the next following slash. As with ASP applications on web servers, information such as Cookies and Sessions cannot be shared between application-domains, each one is self-contained.

The domains provide a clear way to distinguish between each application running on PersonalASP. In addition they play a crucial role in licencing and application source code encoding.

If application source files need to be stored somewhere other than under the <install-path>\PAspPages directory, this can be achieved using the VirtualDirs.txt file. It contains a list of mappings from virtual domain names to physical locations, in the following format:

     [VirtualDirName] > [Physical Path] (with no trailing slash)
eg:
     MyVirtualSite > C:\PersonalASP\MySite (with no trailing slash)

(Note: Internet Explorer will have to be restarted before updates to the VirtualDirs.txt file are detected).


Tools for Developing

ASP pages can be written in any text editing applications, from Notepad upwards. Those already familiar with ASP may well be using tools such as Visual Interdev, which gives useful Intelisense and syntax colouring.


Hello World

The example below was developed using Visual Interdev and tested on a machine running IIS, before being tested against PersonalASP.

Here’s a step-by-step guide to getting a new ASP page up and running.

Write the ASP code

Below is an example of some rather verbose code to output a Hello World message.

- Hello.asp-
    <html>
<body>
<%
   sHello = "Hello"
%>
<hr>
<p align="center">
   <%= sHello & " " & WorldFn %>
<p>
<hr>
<%
'---------------------------------------
function WorldFn()
   WorldFn = "World!"
end function
'---------------------------------------
%>
</body>
</html>

Create a new PersonalASP ‘Application Domain’

The installation process creates a directory called PAspPages in the installation directory. The first level of directories contained in \PAspPages are treated as Application Domains (for example ModeZero is created by the install for the demonstration pages).

(NB:Just like real domains, the pseudo-domain names should not contain spaces).

In this example we'll create a new directory (application domain) under \PAspPages for our Hello World example page called Dev, as that is the developer domain.

Test it

To see the finished product, open Internet Explorer and type pasp://dev/Hello.asp as the URL. The friendly message will appear the the browser.

The Hello World example shows that there are no tricks or hidden steps, the source files don’t get mangled or transformed in any way.


Hello Database World

Creating pages that use the database facilities on PersonalASP is simple and again consistent with the IIS/ASP, using ADO.

Data Source Path

Please note that the full data source path (including drive letter) or full UNC path, should be included when connecting to a database, eg:

g_sDSN = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=E:\PersonalASP\PAspSites\ModeZero\_db\TestCEDB.mdb"

For more information on database driven pages, have a look at the source to the demonstration database pages; VBDbDSN.asp,VBDemoDB.asp and JSDbDSN.asp,JSDemoDB.asp.


Debugging

If there is an error in an ASP script, the error information page format is as follows:

__ASP Error ( [error-code], [approx-line-no], [approx-character] )

Info : [ error-description ]
File : [ error-source-file ]

[ error-line-text ]

(where possible a '^' will appear under the word that caused the error)

approx-line-no
The line number is based on the total script. So any included files will displace the subsequent lines by the number of lines in the included file.

Viewing the Pre-processed Script
Sometimes it is useful to see the exact script being executed (not least because then the line numbers will match exactly).

A file called LastProcessedAsp.txt can be generated in the \PAspPages\_system directory, by adding an underscore (_) at the very end of the URL, eg:

pasp://ModeZero/Default.asp_

Each time a page is called with a trailing underscore the LastProcessedAsp.txt file will be overwritten with the pre-processed script for that page.


Encoding Source Code

The easy way in which ASP can be developed also makes it vulnerable to third parties copying or ‘tweaking’ the code. This can cause problems if technical support are trying to resolve problems and the code has been changed or may result in stolen intellectual property.

We can encode your appliation so pages are not human-readable and consequently not editable. In addition, the pages can be ‘tied’ to the application domain, such that they will only run if in the appropriate domain.

Please get in touch if you would like to make use of this facility.


Appendix 1 – Supported Built-In ASP Objects

- Request -
BinaryRead N 
ClientCertificateN 
CookiesYsingle dimension, such as Request.Cookies("MyCookie")
FormYsingle dimension, such as Request.Form("FormItem1")
(enumeration interface supported)
QueryStringYsingle dimension, such as Request.QueryString("QSItem1")
(enumeration interface supported)
ServerVariablesY - standard -
  • URL
  • SCRIPT_NAME
  • SERVER_NAME
  • QUERY_STRING
  • HTTP_USER_AGENT ("PersonalASP Win32")
- extensions -
  • PASP_SCREEN_WIDTH/HEIGHT
  • PASP_WORKAREA_WIDTH/HEIGHT
  • PASP_DEVICE_TYPE ("Win32 PC")
TotalBytesN 

- Response -
AddHeader Ycall is valid, but no action is taken
AppendToLogN 
BinaryWriteN 
BufferYcall is valid, however output is always buffered
ClearY 
Cookies Ysingle dimension, such as Request.Cookies("MyCookie")
CacheControlNcall is valid, but no action is taken
CharsetN 
CodePageN 
ContentTypeN 
EndYThe rest of the page is processed, although no additional output is added
ExpiresYcall is valid, always returns zero
ExpiresAbsoluteYcall is valid, always returns current date/time
FlushYcall is valid, but no action taken
IsClientConnectedN 
LCID N 
PicsN 
RedirectYsupported by generating a page containing a META refresh to new location
StatusN 
WriteY 

- Server -
CreateObjectY 
ExecuteN 
GetLastErrorN 
HTMLEncodeY 
MapPathY 
ScriptTimeoutN 
TransferN 
URLEncodeY 
RegSvrYExtra PASP Function
  - server.RegSvr([DLL path]) will register the DLL.
  - return is empty string if ok, otherwise error text

- Session -
the CollectionYsingle dimension, such as session("MySesh1") = "fred"
AbandonY 
ContentsN 
CodePageN 
LCIDN 
StaticObjectsN 
SessionIDY 
TimeoutN 
Session_OnStartYcontents of SessionStart.asa are executed the first time a page in a domain is requested (if found in the root of the domain directory)
Session_OnEndN 

- Application -
not supported

- ASPError -
not supported

- ObjectContext -
not supported


Appendix 2 – Further Resources

Discussion Group

Or you can always contact us directly.


To get the latest version of this document please visit http://www.modezero.net/PersonalASP/support.htm.

ModeZero Ltd, 2002.