Application Object
All Objects
All Events
Session.OnEnd
EVENT: Application_OnEnd
The
Application_OnEnd
event occurs when the
Application
ends. This should only happen when the web server is stopped by the operating system in a normal manner. The
Application_OnEnd
event is simply a subroutine with a reserved name that is placed within the Global.asa file. It can contain any script that you wish to run after all user sessions are finished. For example, you may wish to compute and store statistics on user sessions for future reference.
Note: The only built-in ASP objects available from within the OnEnd event handler are Server and Application.
Code:
-------------------Global.asa--------------------------
<script Language="VBScript" RUNAT=Server>
Sub
Application_OnEnd()
Calculate_Stats()
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."
Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information