Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
1901
The Application Object
Introduction
An application is a collection of asp files, which are in a
virtual directory. The application object can be used to define a variable,
which is globally available to all these asp files. The best example of such an
object is to connect to a database once and share the open connection through
the application object. All changes made in the application object will be
available for all pages. This object is mostly used in a global.asa
configuration file.
Example (global.asa)
<script language="VBScript"
runat="Server">
Sub Application_OnStart
Application("Myvar")
= "Hello Word"
End Sub
</script>
Example (application_example.asp)
<%
Response.Write
Application("MyVar")
%>
Output
Methods
Name:
Description:
Contents.Remove(name|index)
This method can be used to remove a specific item from the
application collection. You can either pass the name of the item or the index
as a parameter to the function.
Contents.RemoveAll()
This method can be used to remove all items in an application
collection.
Lock()
This method can be used to lock the application object, so
that nobody else can modify the variables in the collection.
UnLock()
This method can be used to unlock the application object
after it has been locked.
Properties
Name:
Description:
Contents()
This property contains all variables, which has been added
to the collection via the script command.
StaticObjects()
This property contains all objects, which has been added
to the collection via the object command.
Events
Name:
Description:
OnEnd()
This method is called whenever the application ends. It
can be useful to clear up any resources or to close any open connections.
OnStart()
This method is called whenever the application starts for
the first time. It is very useful to open a connection to a dbase or to start
a counter.