PocketASP Version 2.1 - User Guide
A guide to installing, developing and testing PocketASP based applications.
|
|
Contents |
|
|
|
| Introduction |
Active Server Pages (ASP) technology has provided an excellent environment for developers
to rapidly create stable, feature rich, data driven web applications. PocketASP brings this
application development power the Pocket PC, enabling developers to apply their existing
skills to an exciting new platform without the need for new development tools or
additional training.
As well as simplifying the development task, distribution is also made considerably
easier. Just one single version of PocketASP code will run on all supported PocketASP
platforms, so no need to manage numerous MIPS, SH3, ARM, H/PC builds.
|
|
Download and Install |
The PocketASP evaluation version is available from the ModeZero web site at
www.ModeZero.net/PocketASP. The
code is full functional and not time limited, so developers can explore its
full capabilities in their own time.
To install:
On The PC
- Download the appropriate zip file (depending on your Pocket PC type
- Unzip to a temporary location on the PC
- Open the readme.htm file for last minute information and the licence agreement
- Copy the .CAB file onto your Pocket PC
On The Pocket PC
- Close Pocket Internet Explorer (if open).
- Open File Explorer and click on the .CAB file just copied down from the PC
- The required files will be copied and registered and the .CAB automatically removed
Verify the Installation Success
- Open Pocket Internet Explorer
- If the Address Bar is not visible, click View->Address Bar
- Click on the text in the address bar and type pasp://ModeZero/
- The default homepage, “Welcome to PocketASP”, will appear.
|
|
The ModeZero Application Domain |
The pre-installed ModeZero domain home page contains a brief description of PocketASP and links to 3
sections described below: |
Licence Information |
This page displays the unique identifier for the Pocket PC device, this code can be used
when generating licences. In addition all the currently installed licences are listed, 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
PocketASP 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 PocketASP 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 PocketASP. In addition they
play a crucial role in licencing and application source code encoding.
|
|
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.
If IIS is also available, then that makes
the development progress even swifter, as pages can be written and tested on IIS & PC and only as
a final stage downloaded for testing on the device.
|
|
Hello World |
The example below was developed using Visual Interdev and tested on a machine
running IIS, before being copied down to an iPaq H3630 for final testing.
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>
|
|
Test It on the PC (if IIS available) |
Place the Hello.asp file into a virtual directory under IIS. Lets call it Dev.
Navigating to http://<machine-name>/Dev/Hello.asp should result in a
friendly Hello World! message appearing in your browser. |
Create a new Pocket PC ‘Application Domain’ |
The installation process creates a directory called PAspPages in the root
of the Pocket PC. The 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).
Using ActiveSync Explorer create a new directory (application domain) under \PAspPages
for our Hello World example page. Lets call it Dev, as that is the developer domain.
|
Copy to Pocket PC |
Copy the Hello.asp file from the PC into the \PAspPages\Dev\ directory created
in the step above. |
Test it on the PocketPC |
To see the finished product, open Pocket IE and type pasp://dev/Hello.asp. The
same friendly message will appear on your Pocket IE 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 (in fact, you could develop
and edit them on the device). The only alteration that may be needed is to the
look and feel of your pages to make allowances for the amount of screen space available. |
|
Hello Database World |
Creating pages that use the database facilities on the Pocket PC is simple and again consistent with
the IIS/ASP. The database support is provided using ADOCE, which is a subset of ADO. The
core functionality of ADO is provided, i.e. adding, updating and removing
information from tables.
Below are the steps to take to get your ASP application ready for database access:
- Design and create the database on the PC using Access
- Copy the .MDB file into a suitable directory on the Pocket PC
using ActiveSync
- As part of the copy process ActiveSync will convert the database into a .CDB file.
- In addition to the conversion ActiveSync also offers to keep
the master (PC) database and the Pocket PC databases in sync.
- Write ASP pages using standard ADO connect and recordset calls.
(note that the DSN for connection is just the path to the .CDB file created.) |
| |
- Connect to Pocket PC Database -
set oDBCon = Server.CreateObject("ADODB.Connection")
oDBCon.ConnectionString = "data source = \PAspPages\ModeZero\_db\TestCEDB.cdb"
oDBCon.Open
- Open a Recordset -
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.Open "PersonalInfo", oDBCon, 1, 3
|
|
For more information on database driven pages, have a look at the source to the
demonstration database pages; VBDemoDB.asp and 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.
(Note that if you set a files’ attributes
to Hidden/Read Only on the PC before copying them to the Pocket PC, the files
will not appear in Pocket Explorer on the device).
|
|
Appendix 1 – Supported Built-In ASP Objects |
| - Request - |
| BinaryRead | N | |
| ClientCertificate | N | |
| Cookies | Y | single dimension, such as Request.Cookies("MyCookie") |
| Form | Y | single dimension, such as Request.Form("FormItem1") (enumeration interface supported) |
| QueryString | Y | single dimension, such as Request.QueryString("QSItem1") (enumeration interface supported) |
| ServerVariables | Y |
- standard -
- URL
- SCRIPT_NAME
- SERVER_NAME
- QUERY_STRING
- HTTP_USER_AGENT ("PocketASP WinCE")
- extensions -
- PASP_SCREEN_WIDTH/HEIGHT
- PASP_WORKAREA_WIDTH/HEIGHT
- PASP_DEVICE_TYPE
- PASP_OWNER_INFO
|
| TotalBytes | N | |
|
| - Response - |
| AddHeader | Y | call is valid, but no action is taken |
| AppendToLog | N | |
| BinaryWrite | N | |
| Buffer | Y | call is valid, however output is always buffered |
| Clear | Y | |
| Cookies | Y | single dimension, such as Request.Cookies("MyCookie") |
| CacheControl | N | call is valid, but no action is taken |
| Charset | N | |
| CodePage | N | |
| ContentType | N | |
| End | Y | The rest of the page is processed, although no additional output is added |
| Expires | Y | call is valid, always returns zero |
| ExpiresAbsolute | Y | call is valid, always returns current date/time |
| Flush | Y | call is valid, but no action taken |
| IsClientConnected | N | |
| LCID | N | |
| Pics | N | |
| Redirect | Y | supported by generating a page containing a META refresh to new location |
| Status | N | |
| Write | Y | |
|
| - Server - |
| CreateObject | Y | |
| Execute | N | |
| GetLastError | N | |
| HTMLEncode | Y | |
| MapPath | Y | |
| ScriptTimeout | N | |
| Transfer | N | |
| URLEncode | Y | |
| RegSvr | Y | Extra PASP Function - server.RegSvr([DLL path]) will register the DLL. - return is empty string if ok, otherwise error text
|
|
| - Session - |
| the Collection | Y | single dimension, such as session("MySesh1") = "fred" |
| Abandon | Y | |
| Contents | N | |
| CodePage | N | |
| LCID | N | |
| StaticObjects | N | |
| SessionID | Y | |
| Timeout | N | |
| Session_OnStart | Y | contents 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_OnEnd | N | |
|
| - Application - |
| not supported |
|
| - ASPError - |
| not supported |
|
| - ObjectContext - |
| not supported |
|
|
Appendix 2 – Further Resources |
Discussion Group
FAQ
Or you can always contact us directly. |
|
|
To get the latest version of this document please visit http://www.modezero.net/PocketASP/support.htm.
ModeZero Ltd, 2003. |