Global.asa Reference (ii)-Application event

Source: Internet
Author: User
Tags reference terminates root directory
Application| an ASP based application consists of all the files in its root directory and its subdirectories. The application starts when a user first opens a Web page in the application,
Terminates when the service is closed. The application has two events, namely the Application_OnStart event and the Application_OnEnd event.

Users can specify scripts for these events in the Global.asa file. When the application starts, the server looks up and processes in the Global.asa file
Application_OnStart event script. When the application terminates, the server processes the Application_OnEnd event script.


1.application_onstart
The Application_OnStart event occurs before the first time a new session (that is, a Session_OnStart event) is created. Only Application and Server built
The object is available. Referencing the session, Request, or Response object in the Application_OnStart event script results in an error.

Grammar
<script language=scriptlanguage runat=server> Sub Application_OnStart ... End Sub

</SCRIPT>

Parameters
ScriptLanguage
Specifies the scripting language used to write event scripts. It can be any language that supports scripting, such as VB script or JScript. If multiple events use the same
Scripting languages, you can organize them under a <SCRIPT> tag.

2.application_onend
The Application_OnEnd event occurs after the application exits after the Session_OnEnd event, and only application and Server-built objects are available.

Grammar
<script language=scriptlanguage runat=server> Sub application_onend ... End Sub

</SCRIPT>

Parameters
ScriptLanguage
Specifies the scripting language used to write event scripts. Can be any language that supports scripting, such as VBScript or JScript. If there are multiple events using the same
A scripting language in which you can organize them under a set of <SCRIPT> tags.
Comments
The MapPath method cannot be invoked in the Application_OnEnd script.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.