Chapter 9. Writing Web Applications

Table of Contents

Session Management
Using Session Variables
Clearing Session Variables
Enumerating Session Variable
Accessing Databases
Data Sources
Connections and Recordsets
Database Metadata

Session Management

Session variables allow persistency between page accesses. RSP session variables are only guaranteed to work if the user's browser allows cookies. On his first access the user is assigned a unique identifer through a cookie. Subsequently the user provides this cookie when accessing pages and thus the web server can assign the correct session to the page access. If a session is dormant for too long it will be destroyed and the memory it used released.

An RSP session consists of a list of session variables. Each session variable has a string name and a string value. RSP does not support non-string session variables.

Using Session Variables

You can set and reset a session variable using the setsession() function. Subsequently you can read a session variable's value using the session() function.

Clearing Session Variables

To remove a session variable and all the memory associated with it use the clearsession() function. If you use this function with no arguments it will remove all session variables. Session variables are often used to hold login information, clearing them all at once is a good way to log off the user.

Enumerating Session Variable

The sessionkeys() function returns an array of all the session variables.