Developer

Run ASP applications on a Pocket PC

Have a nice ASP site that you need to run (at least part of it) on a Pocket PC? Microsoft doesn't give you an easy answer, but thanks to London-based ModeZero, there's a way--PocketASP.


When my manager mentioned the possibility of a project for a device running Windows CE, I decided to check out the available development options. Now since our shop has a big investment in classic Active Server Pages and the entire team is familiar with ASP, then ASP was obviously the place to start.

Unfortunately, Microsoft doesn’t currently offer either IIS or PWS (Personal Web Server) for Windows CE devices. However, all is not lost. A company in London, ModeZero, offers a product called PocketASP that is designed for use in handhelds. The software isn’t free for commercial use, but it can be downloaded free for nonprofit use.

Once downloaded, PocketASP installed quickly and smoothly. It was, in fact, the first software that I installed myself on my just-out-of-the-box PDA. After the installation completed, I found that the software included sample code for every conceivable task you might want to perform with PocketASP (Figure A). And there's an online group on Yahoo that deals specifically with development under PocketASP.

Figure A
The PocketASP installation includes plenty of example code for you to peruse.


Exploring PocketASP
Trying and then examining the sample code that comes with PocketASP left me feeling like there was some kind of trick involved. After all, here was a device that weighed mere ounces yet was running ASP originally written for much larger machines. After some poking around in the code, I finally accepted the fact that there was no trick. PocketASP really works.

Now it's not a full implementation of ASP; instead it's a subset of the most commonly used objects (Table A). As with regular ASP, developers have the choice of coding in either VBScript or JavaScript. However, newer PDAs have problems accessing databases in JavaScript because ADOCE (ActiveX Data Objects for CE) is not marked as safe for scripting. This is an issue for JavaScript only; with VBScript, database access works fine.
Table A
Object Property | Collection | Method | Event Notes
Response AddHeader No action, information only
Response Buffer No action, information only
Response CacheControl No action, information only
Response Clear  
Response Cookies  
Response End  
Response Expires  
Response ExpiresAbsolute  
Response Flush No action, information only
Response Redirect  
Response Write  
Server CreateObject  
Server HTMLEncode  
Server MapPath  
Server RegSvr PocketASP only
Server URLEncode  
Session Abandon  
Session Collection  
Session OnStart  
Session SessionID  
The subset of ASP supported by PocketASP

Querying a database with PocketASP
Once my initial explorations were complete, I decided to try out one of my own Active Server Pages with PocketASP (Listing A). I wanted to build an HTML table from information stored in the database table shown in Figure B.

Figure B
Example database table


The user would then have the option to increment quantities on a form, click a button to update a table, and then display a page reflecting those updates (Figure C).

Figure C
Sample PocketASP page resulting from a query against table in Figure B


Though I don’t know for certain, I expect that the majority of code developed for PocketASP will be created on another platform because, while Windows CE devices are powerful, they usually don't come with a full-size keyboard. Also, there aren’t a lot of code editors available for use on the Windows CE platform. With this in mind, and noting the object changes between regular ASP and PocketASP, I wrote a version of my code (Listing A) on my laptop.

While I’m not a newcomer to writing code on one platform that's destined to run on another, I thought I'd have a major problem with PocketASP being a subset of ASP. But that really isn’t the case as long as you remember not to do too many things in one statement. By far, the most difficult part was the need to repeatedly remind myself that there's a major difference in display size and shape—240 by 300 pixels instead of 1024 by 768.

Once my personal demons were conquered, I found PocketASP surprisingly powerful and reasonably fast. While the speed might be due to the hardware I was using (my Toshiba e330 Pocket PC has a 300 MHz processor), the power shows that ModeZero put real thought into what ASP features to incorporate into PocketASP.

PocketASP provides a viable alternative for ASP shops wanting to try handheld application development. With PocketASP’s downloadable manuals, Yahoo user group, and plentiful code samples, it's a good way to avoid sharp learning curves.

Editor's Picks

Free Newsletters, In your Inbox