Session Object
All Collections
All Events
All Methods
All Objects
All Properties
Application.OnStart
EVENT: Session_OnStart
The
Session_OnStart
event occurs just before the server creates the
Session
object. The
Session_OnStart
event is simply a subroutine with a reserved name that is placed in the Global.asa file. You can place any code you desire inside this subroutine. All of the built-in ASP objects are available from within the Session_OnStart event handler.
Code:
-------------------Global.asa--------------------------
<script Language="VBScript" RUNAT=Server>
Sub Application_OnEnd()
End Sub
Sub Application_OnStart()
Application("NumSession") = 0
Application("NumVisited") = 0
End Sub
Sub Session_OnEnd()
Application("NumSession") = Application("NumSession") - 1
End Sub
Sub
Session_OnStart()
Application("NumSession") = Application("NumSession") + 1
Application("NumVisited") = Application("NumVisited") + 1
End Sub
</script>
-------------------File1.asp----------------------------
Response.Write "You are " & Application("NumSession") & " of " & Application("NumVisited") & " users."
Output:
You are 1 of 3 users.
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information