Re: Session management module: how ASP does it
| From: | Jim Zajkowski | Date: | Sat, 29 May 1999 00:41:11 +0000 |
| Subject: | Re: Session management module: how ASP does it | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-6228@lists.php.net to get a copy of this message | ||
On Sat, 29 May 1999, Zeev Suraski wrote:
} ASP's session API, as far as I know, is equivalent to this:
}
} session_start();
} session_variable($var);
} session_end();
Having used ASP for too many projects, I'll say that it's even easier than
this.
In ASP, you just assign 'session("keyname") = value', so, you could:
<% Session("firstname") = "Jim" %>
and then get it with <%= Session("firstname") %>
ASP also allows for application-wide variables. Those work the same way,
except it's Application() rather than Session(). App variables also have
.Lock and .Unlock methods for mutex-like critical sections. Sesssion
variables I believe are always synchronized. Sessions can be force-closed
too, you just call Session.Close().
ASP allows apps to write handlers for when the App starts (first hit), App
shuts down (IIS stopped), Session init, Session close, and Page open and
Page close. They all must be in the global.asa file, based on some
heirarchical system of directories that I don't really care about. You
simply write a function Session_OnClose or Session_OnOpen, etc...
Session on-close trapping is *key* for sites like Amazon and
drugstore.com, which have one-click ordering where the order is sent when
the session goes out of state. ASP does it out of the box.
drugstore.com uses ASP, incidentally.
You may not want that level of easy-ness, since it seems clunky to
implement. The Java Servlet API works where you instantiate a Session
class and then call getVariable and setVariable passing a key and a
variable (or passing a key and getting a variable).
Jim
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net