/*-------------------------------------------------------------------------------------/
*-->Author: Paramecium
*-->Time: 2007-4.28---2007-4.30 (It turned out to be a manual written by myself, and I am now posting it here)
*-->Contact:[email protected]
*-->Document functions:
1. Review ASP, deepened my understanding of ASP structure and ASP experience
2. It can be used as ASP reference. It is written by yourself, making it more convenient to refer to it.
This is the fourth part: Global.asa
/*-----------------------------------------------------------*/
I won’t describe the ASP components. When encountering important components (mainly third-party components), such as uploading components, etc., we will specialize in them.
introduce
/*===========================================================================================================*/
/*-----------------------Global.asa-------------------------*/
.asa is the file suffix name, which is the abbreviation of ActiveServerApplication. Global.asa file can
Manage two very demanding objects in ASP applications: Application, Session
Global.asa is an optional file in which the program writer can specify event scripts and declare that they have sessions and
Application scoped object. The contents of this file are not used to display to the user, but to store event information and
Objects used globally by the application. This file must be stored in the root directory of the application. There can only be one per application
Global.asa files
The most common misconception about Global.asa files is that it can be used as a library for general use functions and subroutines. The Global.asa file can only be used to create references and capture startups of objects, as well as end Application objects and Session objects.
The Global.asa file is accessed based on session-level events and is called in the following three situations:
1. When the Application_OnStart or Application_OnEnd event is triggered.
2. When the Session_OnStart or Session_OnEnd event is triggered.
3. When referring to an object (Object) that is instantiated in the Global.asa file.
The standard file format of Global.asa is as follows:
<SCRIPTLANGUAGE="VBScript"RUNAT="Server">
SubApplication_OnStart
'Application_OnStart runs when any customer first accesses the homepage of the application
EndSub
SubSession_OnStart
'Session_OnStart Runs when the client first runs any page in the ASP application
EndSub
SubSession_OnEnd
'Session_OnEnd runs when a client's session timed out or exits the application
EndSub
SubApplication_OnEnd
'Application_OnEnd runs when the site's WEB server is down
EndSub
</SCRIPT>
Two examples about the Global.asa classic:
1. Forced entry into the homepage is the method of force-locating to the homepage if you visit the website for the first time:
<SCRIPTLANGUAGE="VBScript"RUNAT="Server">
SubSession_OnStart'As long as the user logs into this site for the first time, it will jump to the homepage