0% found this document useful (0 votes)
4 views

Application

The document explains the concept of an application in ASP, which consists of a group of ASP files that work together and share information among users. It describes the Application object, its collections (Contents and StaticObjects), methods for managing application data, and events that trigger during the application's lifecycle. Key functionalities include creating and accessing application-level variables, locking mechanisms for data integrity, and handling application start and end events.

Uploaded by

M Mussawar Sher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Application

The document explains the concept of an application in ASP, which consists of a group of ASP files that work together and share information among users. It describes the Application object, its collections (Contents and StaticObjects), methods for managing application data, and events that trigger during the application's lifecycle. Key functionalities include creating and accessing application-level variables, locking mechanisms for data integrity, and handling application start and end events.

Uploaded by

M Mussawar Sher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Application

APPLICATION OBJECT:
In other languages an application is often a single
executable file that may have many different functions. An
application on the web may be a group of ASP files within a single
directory, including any subdirectories. The ASP files work together
to perform some purpose. A group of ASP files that work together to
perform some purpose is called an application.
The application object in ASP is used to tie ASP files
together . In this way, information can be shared among the users of
the web application. This object is typically used to create variables
that maintain application level scope.
For example to create a variable "UserID" and assign
value "BCS001" to it,
Application("UserID") = "BCS001" OR
Application.Contents("UserID") = "BCS001"

The Application object should hold information that will be


used by many pages in the application. This means that you can
access the information from any page. You can also change the
information in one place and the changes will automatically be
reflected on all pages.

COLLECTIONS:
Page 1
Application
1) Contents: It contains a collection of all the items that
have been added to the application through a script command. You
can loop through the Contents collection using For Each/Next
statement to access all its contents
<% Dim i
For Each i In Application.Contents
Response.Write(i & "<BR>")
Next %>
2) StaticObjects: It contains all the objects added to the
application with the HTML <object> tag. You can also loop through
the Object using For Each/Next statement to access all its objects
<% Dim i
For Each i In Application.StaticObjects
Response.Write(i & "<BR>")
Next %>

METHODS:
1) Contents.Remove: It is used to delete (or remove) a
specified item from the contents collection. For example to remove
the item named "UserID" from the collection code is
Application.Contents.Remove "UserID"
2) Contents.RemoveAll: It is used to delete all items from
the contents collection. Application.Contents.RemoveAll
Page 2
Application
3) Lock: It is used to lock the application object to that only
one user at a time can modify the values of variables.
4) Unlock: It is used to unlock the application object (after
it has been locked using the LOCK method). In this way other user
can modify the variables in the Application object. For example to
lock the application and then unlock it after performing some
operations on its items/variables
<% Application.lock
'hgsjhkdjg;nejhfjv;lsdmnf
Application.unlock %>

EVENTS:
1) Application_OnStart: This event occur when the first
user calls the first page from an ASP application.
2) Application_OnEnd: This event occur after the last user
has ended the session. Typically, this event occur when the
application ends/stops.

Page 3

You might also like