ASP's application objects and session objects

Source: Internet
Author: User
Tags sessions
This chapter has discussed two ASP objects: The Application object and the Session object, thus being able to access the collections, methods, properties, and events provided by application objects and sessions objects. This section will study these two objects from the perspective of programming.
· 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.
· When the visitor first requests an ASP page from the site, create a session object for him and remain valid until the default time-out period (or the timeout period determined by the script). This object provides a storage place to store variables and objects that are available only to pages that the visitor opens during the session's activity.
Figure 3-12 (Figure 1-20) gives the user's request and the distribution of the server's response in the session. All sessions are in an ASP application.
3.3.1 ASP's Application Object member overview
This section describes the collection, methods, and events of the Application object (Application object has no attributes). The Session object (with attributes) is described in the next section. You will then continue to explore the tasks accomplished by using these objects and describe in more detail how each member of each object works.
1. Collection of Application objects
The Application object provides two collections that can be used to access variables and objects stored in the global application space. The collection and description are shown in table 3-3:
Table 3-3 the collection and description of application objects
Collection
Description
Contents
There is not a collection of all the variables (and their values) that are stored in the Application object, as defined by the <OBJECT> element. References that include variant arrays and instances of variant type objects
StaticObjects
A collection of all the variables (and their values) that are stored in the Application object, using the <OBJECT> element definition
2. Methods of Application objects
The Application object method allows you to delete values in the global application space and control concurrent access to variables within that space. Methods and instructions are shown in table 3-4:
The method and description of table 3-4 Application Object
Method
Description
Contents.Remove ("Variable_name")
To remove a variable named Variable_name from the Application.content collection
Contents.RemoveAll ()
Remove all variables from the Application.content collection
Lock ()
Locks the Application object so that only the current ASP page can access the content. A concurrent operation that ensures that two users are allowed to read and modify this value at the same time does not break the content
Unlock ()
Unlock an ASP Web page on a Application object
Note that you cannot delete a variable from the Application.staticobjects collection during run time.
Related Article

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.