Reliable User Session class for ASP 3

Recently at work I had ported over in ASP a very good, and very reliable user session class written in PHP 5. The original class came from the code download of WROX’s Professional PHP5 book. I had been using it for quite a while beforehand and it’s been nothing but a time-saver, so I decided to take the time to port it over to ASP so I could use it in some work projects. So if, god forbid, you’re still having to use the 7 year-old technology that is ASP 3 (note: pre-.NET) — and don’t worry, I feel your pain — then this class may certainly be for you. You can download it below:

clsUserSession.txt (Plain Text Format, 227 lines, 8.1kb)

It seems a little clunky and big for what it is, but I haven’t had any problems with it. It’s worked beautifully.

You should be able to determine what sort of database tables and fields you’ll need by making a quick browse through the code. To use it, just follow this basic outline:

Set objUS = new clsUserSession ' create the object
objUS.Impress ' and impress it on every page
objUS.Login("email", "password") ' login
objUS.set_var("var name", "var value") ' store a session variable
Response.Write objUS.get_var("var name") ' retrieve the variable
objUS.Logout ' log out

Pretty simple stuff. Hopefully someone finds use for this!

One Response to “Reliable User Session class for ASP 3”

  1. andrewfreiday.com » Blog Archive » PHP Pagination with a Collection Class Says:

    […] Recently in my work I had begun using some of the code offered from WROX’s Professional PHP 5 book. Earlier, I even wrote about the UserSession class that I ported from PHP 5 to ASP 3. […]

Leave a Reply