Open In App

ASP Application_OnEnd Event

Last Updated : 18 Dec, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

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 

  • ScriptLanguage: It defines the Language of the script which is used to write a event script.It supported different scripting language, such as VBScript or JScript.

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."

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads