Image of Navigational Map linked to Home / Contents / Search Getting your feet wet with Active Server

by Mark Trescowthick - GUI Computing
Image of Line Break

OK, we've all heard the hype about Active Server Pages. And we know that they're built using a weird combination of HTML and VB Script or Java. And we know we can do data access and all sorts of other good stuff with them which is, basically, browser-independent. And setting up an environment to develop them is cheap - like free, if you don't count the download time!

So why then, I wonder, haven't well all dived in and had a go? After all, VB is a skill most of those reading this already had, and HTML is a doddle (and there are so many HTML resources around it's plain silly). I can't speak for you, but as for myself I think I was put off by what I thought I already knew about authoring web pages and concerned that the technology for Active Server Pages wasn't quite ready for prime time. I think the fact that Microsoft themselves show developing an Active Server site as being a combined FrontPage / Visual InterDev exercise (with some SQL Server or Access work thrown in to break the monotony!) might have had something to do with that impression.

But it's wrong! This is absolutely easy, folks, and the resources are absolutely everywhere!

After I installed the Active Server Pages download from MS (all 9.5MB of it!) I simply installed it on my Personal Web Server (also available as a download, but it comes with FrontPage and Visual InterDev) and, hey presto, it was working. Even better, it had installed a pretty cool little sample site which did some basic database access and such as well.

So, using the ever-reliable Ed for Windows, I thought I'd see how long it took to create an Intranet page which let me search our (Access) Client Database.

Step One, of course, was to find the appropriate page in the sample app. And yes, there is one which does a listing of all customers - just the sort of thing I wanted. A small bit of hacking (and one minor bug fix, of which more in a moment), set up an ODBC data source and I actually had it operational. Of course, it was pretty primitive, and only allowed a full list, but I was pretty chuffed.

The next step was to give myself some basic search capabilities. That was simply a matter of creating a small form (FrontPage 97 for this) which basically had one input box, a couple of radio buttons and a Submit and Clear button. I couldn't resist slapping on a 'Powered by BackOffice' logo either, just for fun.

Now, what I really wanted was the Search Form in a frame at the top, with my listings presented in a frame below. Again, FrontPage 97 is the go for creating framesets and that was soon operational too.

Well, nearly operational. The sample shows a listing where email addresses are listed as active Mailto: links. Which is a great idea - pity it didn't work! Their code looks like this :

<A HREF="mailto:"> <%= RScustomerList("Email")%> </A >

Which would appear at first glance to be correct but which doesn't work. I'm pretty sure that's because they omit to put quotes around the Email address. In any event, a quick bit of VB solved that. To Whit :

<% if RSCustomerList("Email") <> "" then
		EmailAddress = "'mailto:" & RSCustomerList("Email")& "'"
		EmailAddress = ""
   end if %>
<A HREF= <% = EmailAddress %>> <% =RSCustomerList("Email") %> </A>

Some testing, and it was time to go live on our Intranet server. Just a simple matter of creating a directory and moving some files. Now for the big test.

SPLAT! The Active Server Pages were there, and the browser showed them alright, but none of the 'active' bits were, well, active. I was just seeing all the VB Script code looking like it was bad HTML.

Search, search, search. Very weird. I even tried moving it into the directory the sample came from - from where it worked perfectly! Turns out, of course, that RTFM was the problem. I hadn't marked the directory to allow execution from within the IIS admin utility. Once that was sorted, everything worked perfectly.

I was now the proud owner of a primitive, but effective customer listing (which you can download, if you feel the need).

Imagine my absolute disgust when I installed Visual InterDev about a week later to discover that it has the biggest, flashest database access wizard you ever did see! Never mind - I'd learnt a lot, and doing it all from first principles is no bad way to learn.

For more on Visual InterDev and FrontPage, see my review in this issue.

Written by: Mark Trescowthick
May '97

Image of Arrow linked to Next Article
Image of Line Break