When you have a computer you want a operating system on it. When you have a operating system you want applications that users can run under that operating system. Microsoft makes a lot of applications and thus Windows has a lot of applications. The MacOS also has a lot of applications. Linux has applications for geeks but not much applications for the average user. Examples are word processors, spreadsheets, web servers, etc. (Also called program.)

An application is an executable program which fulfills some end-user need. Examples are word processors, spreadsheets, and games. On the other hand, programs such as web servers, print spoolers, and other things that provide some sort of service are generally not considered applications. A computer runs an operating system which runs applications and services which provide some sort of utility or back-end to the applications.

A logical sequence of instructions specifying the operations to be performed by a computer in solving a problem or processing data for performing a specific task.

Example: word processing application

ASP Application Object

The Application object represents an ASP-based application. (An ASP-based application is defined as all of the .asp files in a virtual directory and it's subdirectories.) It shares, stores, and retrieves information in response to requests from users to the application. This information is global (shared over all user sessions). In ASP, this is also known as "application scope" information.

Adding and retrieving information with the Application object (VBScript):

<%
  Application("A_String") = "String variable"
  Application("Sum") = 5 * 5
  Set Application("FileSystemObject") = Server.CreateObject("Scripting.FileSystemObject")

  my_string = Application("A_String")
  'my_string is now equal to "String variable"

  my_sum = Application("Sum")
  'my_sum is now equal to 25

  Set fso = Application("FileSystemObject")
  'fso is now a FileSystemObject object
 
  'Application.Contents("A_String") == Application("A_String")
  'Application(key) is a shortcut for Application.Contents(key).
%>

Collections

Contents Collection
A collection of all of the items which have been created and added to the Application object during client sessions through script commands, such as the Server.CreateObject, rather than by using the HTML <OBJECT> tag.

StaticObjects Collection
A collection of all of the items which have been created and added to the Application object during client sessions by using the HTML <OBJECT> tag, rather than using script commands.

Methods

Contents.Remove Method (v 3.0)
The Contents.Remove method is used to remove a single item from a Contents collection.

Contents.RemoveAll Method (v 3.0)
The Contents.RemoveAll method is used to remove all items from a Contents collection.

Lock Method
The Lock method prevents all other users from making changes in the Application object. Since the Application object can be shared by more then one user, the Lock method is provided to ensure that multiple users cannot alter a property simultaneously (see synchronization).

Unlock Method
The Unlock method allows any user to have access to any of the Application object properties in order to make changes.

Events

OnEnd Event
The OnEnd event occurs when the Application quits. This should not occur unless all user sessions are over. The signal of this event will run a handler script in the Global.asa file, if the script exists. This is a good time to remove all of the contents of the Application object to release memory.

Example of a OnEnd handler function. This script will remove all information from the Application object, and free the memory it was using.

  <script language="vbscript" runat="server">
    Sub Application_OnEnd
      Application.Contents.RemoveAll
    End Sub
  </script>

OnStart Event
The OnStart event can occur at two times.
1) The first time a new user session is started.
2) Any time a new user session is started after the OnEnd event is generated.
The signal of this event will run a handler script in the Global.asa file, if the script exists.

Example OnStart handler script. This script initializes a Application scope counter, which can be used to count the number of visitors since the last time the application was restarted.

  <script language="vbscript" runat="server">
    Sub Application_OnStart
      Application("VisitorCount") = 0
    End Sub
  </script>

Tips & Hints

Large Arrays & Application Objects
Storing large arrays in Application or Session objects is a bad idea. The semantics of most scripting languages require that before you can access any element of the array, a temporary copy of the entire array must be made. This effectively uses up twice the memory to store the array. Generally, this isn't something you want to do.

Application Level Components?
You'd like that COM/COM+ object you just wrote to be available across all of your user's sessions? Think that creating one global reference of the component will improve performance (by not having to create and destroy the object on individual pages)? In most cases, placing a component in the Application object will degrade performance, not increase it. Why?

ASP maintains a pool of worker threads that service requests. Normally, the request is handled by the first available thread. However, ASP must create a special thread to run non-agile1, Application scoped components. What this means is that all calls to this component must now use this special thread and all calls are serialized. So instead of using the first available thread, every call to this component must wait on one unique thread. As load increases (and the component is called more frequently), this will kill performance.


Back to ASP Objects



1ASP components can be classified as "agile" and "non-agile" components. The difference is in the way they handle thread synchronization. Most components fall into the "non-agile" category.

Resources:
http://www.devguru.com
http://msdn.microsoft.com/asp/

All code is my own (but it can be yours for 3 easy payments of $29.95!)

(v 3.0) indicates that this feature is only available with ASP Version 3.0, which shipped standard with IIS 5.0

Ap`pli*ca"tion (#), n. [L. applicatio, fr. applicare: cf. F. application. See Apply.]

1.

The act of applying or laying on, in a literal sense; as, the application of emollients to a diseased limb.

2.

The thing applied.

He invented a new application by which blood might be stanched. Johnson.

3.

The act of applying as a means; the employment of means to accomplish an end; specific use.

If a right course . . . be taken with children, there will not be much need of the application of the common rewards and punishments. Locke.

4.

The act of directing or referring something to a particular case, to discover or illustrate agreement or disagreement, fitness, or correspondence; as, I make the remark, and leave you to make the application; the application of a theory.

<-- p. 73 -->

5.

Hence, in specific uses: (a) That part of a sermon or discourse in which the principles before laid down and illustrated are applied to practical uses; the "moral" of a fable. (b) The use of the principles of one science for the purpose of enlarging or perfecting another; as, the application of algebra to geometry.

6.

The capacity of being practically applied or used; relevancy; as, a rule of general application.

7.

The act of fixing the mind or closely applying one's self; assiduous effort; close attention; as, to injure the health by application to study.

Had his application been equal to his talents, his progress night have been greater. J. Jay.

8.

The act of making request of soliciting; as, an application for an office; he made application to a court of chancery.

9.

A request; a document containing a request; as, his application was placed on file.

 

© Webster 1913.

Log in or registerto write something here or to contact authors.