Thanks. I have cut and paste your codes into global.asa n placed them in my root directory.
I also tried to show the session "start" and "visitorID" in my main page after loggin in, but it is not showing. Why? It seems to me global.asa is not being read by my application. Wrong directory?
Another qn:
If I want to use <% Session.Timeout = 1 %> (1 min for testing purposes) , where do I place this code? Global.asa or another .asp file?
Main Topics
Browse All Topics





by: gawaiPosted on 2006-05-26 at 22:46:46ID: 16774274
Global.asa
open up notepad and save it as "Global.asa" in notepade use double quote (") to save asa or asp file otherwise windows will save it as Global.asa.txt
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Application_OnStart
Application("visits") = 0
Application("Active") = 0
End Sub
Sub Session_OnStart
Session("Start") = Now ' here is the name of session
Application.lock
Application("visits") = Application("visits") + 1
intTotal_visitors = Application("visits")
Application.unlock
Session("VisitorID") = intTotal_visitors
Application.lock
Application("Active") = Application("Active") + 1
Application.unlock
End Sub
Sub Session_OnEnd
Application.lock
Application("Active") = Application("Active") - 1
Application.unlock
End Sub