Dreamweaver UltraDev Cookbook

Securing Individual Pages Example

Hiran de Silva
June 2000

This is a follow up to the User Login Example.

I am assuming that

You are familiar with Dreamweaver
You are now a proud owner of Dreamweaver UltraDev trying to figure it out
You are comfortable with MS Access
You are new to VBScript but have done some simple programming before

How does the Securing Pages Example work?

Let's try it out, shall we?

First we need to login as somebody. So, if you haven't done so already, go to the Login page and log yourself in as UserID: John and Password: Lennon. In this example John Lennon has access level Admin.

At this point let us also welcome all those Beatle fans surfing on to this page via Yahoo! ...

Back to the tutorial. Now go to this page which is secured. If you logged in as John or Paul you are ok. If you logged in as anybody else you'll be directed to a page that tells you to go away. Sorry George and Ringo, but I think you are fab:)

So how is it done?

Easy.

You may remember in the Login Example the login page retrieves the user's AccessGroup and stuffs it into a Session Variable called svAccessGroup. Remember the LoginOK page picks this up and displays it?

All we need to do here is to add a tiny bit of ASP code that checks the value of svAccessGroup and redirects accordingly. Here's what it looks like.

So, to recap. Insert the above bit of code above the <HTML> tag on each page you want to secure. Amend the access group as required. Make sure you include the <%@LANGUAGE %> statement at the beginning, unless it is already there.

With some imagination you can devise a progressive access level, say 1 to 7. For example, a page is accessible by persons with access levels 5 and over. I shall leave you to figure out the code from the above ...

Wow. Is that all?

Yup!

Next we will look at New User Registration.
That'll be another day. Go take a break.

Read the Reviews