Open In App

ASP Application_OnEnd Event

The ASP Application_OnEnd Event occurs after the Application ends or quits.It occurs when the session is over.Thus event is placed in the Global.asa File.This all can be happen only when the wenserver stopped working.

Note: The only built-in ASP objects available from within the OnEnd event handler are Server and Application.

Syntax 

<SCRIPT LANGUAGE=ScriptLanguage RUNAT=Server>
Sub Application_OnEnd. . . End Sub
</SCRIPT>

Parameter Values 

Example Code: 

<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."
Article Tags :