View Full Version : is needed the global.asa file for simple usage of session vars ?

06-29-2007, 07:46 PM
is needed the global.asa file for simple usage of session vars ?

06-29-2007, 08:18 PM
No. Session variables do not need the global.asa file.

Global.asa is used mainly (although not entirely) for connectivity to Access, while session variables are kept in server's memory (which is why it is so important to destroy variables, connections, and sessions when page/applications are complete).


06-30-2007, 11:51 PM
Application vars may defined/declared outside the global.asa file [in a file of an application] ? This applys to find visitors in each webpage of an application [of 4 pages] ?

07-01-2007, 04:40 AM
You can use both session and application variables without the global.asa.

Session variables and Application variables are only separated by who can see them -- session vars are only for a specific user (based on session ID), while application vars are available for everyone.

07-09-2007, 01:01 PM
Can you give me an example using application variables in an .asp file ? eg if I have a shopping cart and I want to see how many visitors currently active-non checkd-out yet, and visitors have checked out , how to immplement it ?

07-09-2007, 02:43 PM
What you are looking at doing with an Active User Counter DOES need a global.asa, because only there does it have the 4 event handlers that you need.

However, application variables that you want to set for each user do not.

For example: Titles on every page

On your opening page (default.asp, index.asp. logon.asp, etc...)

<% application("strTitle") = "This is lse123's Shopping Cart" %>

<title><%= application("strTitle") %></title>

Every other page should have <title><%= application("strTitle") %></title>. That way, all of your pages have the same title and it only needs to be changed in one place.

As to Active User counters, check out ASP 101's Active User Counter (http://www.asp101.com/resources/active_users.asp).