Oggetto applicazione ASP


Un gruppo di file ASP che lavorano insieme per svolgere uno scopo è chiamato applicazione. L'oggetto Application viene utilizzato per collegare insieme questi file.


Oggetto dell'applicazione

Un'applicazione sul Web può essere costituita da diversi file ASP che funzionano insieme per eseguire uno scopo. L'oggetto Application viene utilizzato per collegare insieme questi file.

L'oggetto Application viene utilizzato per memorizzare e accedere alle variabili da qualsiasi pagina, proprio come l'oggetto Session. La differenza è che TUTTI gli utenti condividono UN oggetto Application (con Sessions c'è UN oggetto Session per OGNI utente).

L'oggetto Applicazione contiene informazioni che verranno utilizzate da molte pagine dell'applicazione (come le informazioni sulla connessione al database). Le informazioni sono accessibili da qualsiasi pagina. Le informazioni possono anche essere modificate in un'unica posizione e le modifiche si rifletteranno automaticamente su tutte le pagine.

Le raccolte, i metodi e gli eventi dell'oggetto Application sono descritti di seguito:

Collezioni

Collection Description
Contents Contains all the items appended to the application through a script command
StaticObjects Contains all the objects appended to the application with the HTML <object> tag

Metodi

Method Description
Contents.Remove Deletes an item from the Contents collection
Contents.RemoveAll() Deletes all items from the Contents collection
Lock Prevents other users from modifying the variables in the Application object
Unlock Enables other users to modify the variables in the Application object (after it has been locked using the Lock method)

Eventi

Event Description
Application_OnEnd Occurs when all user sessions are over, and the application ends
Application_OnStart Occurs before the first new session is created (when the Application object is first referenced)