ASP Getting Started tutorials-application Objects Overview

Source: Internet
Author: User

I. Overview of Application objects

When loading an ASP DLL and responding to the first request for an ASP Web page, create the Application object. This object provides a storage place to store variables and objects that are available to all Web pages that are open to all visitors

You can use the Application object to share information between all users of a given application. An ASP based application is defined in a virtual directory and its subdirectories, as with all. asp files. Because multiple users can share application objects, there must be a Lock and Unlock method to ensure that multiple users cannot change a property at the same time.

Application objects are used primarily for:

1 statistics of the number of visitors to the website;

2) Statistics of the number of clicks;

3) Create chat room;

4 Read the data in the database and so on.

The syntax format of the Application object is as follows:

Application 集合 | 方法

Second, the Session object collection

The Application object provides two collections that can be used to access variables and objects stored in the global application space. As shown in Table I:

Table I
Collection Meaning
Contents Contains items that have been added to the application with script commands, Contents is the default collection of application objects.
StaticObjects Contains objects created with the object tag and given the scope of the application.

Three, Application object method

Table II
Method Meaning
Contents.Remove Deletes an item from the contents collection of the Application object.
Contents.RemoveAll Deletes all items from the contents collection of the Application object.
Lock Prevents other users from modifying the Application object's variables.
Unlock Allow other users to modify the Application object's variables.

Iv. Application object events, such as Table III:

Table III
Event Meaning
Application_OnStart Triggered when ASP starts, before the Web page that the user requests is executed and before any user creates the Session object. Used to initialize variables, create objects, or run other code.
Application_OnEnd Triggered when an ASP application is finished. Occurs after the last user session has ended and all the code in the OnEnd event of the session has been executed. When it ends, all variables present in the application are canceled.
See the full set of ASP Getting started tutorials

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.