ASP - toepassingsobject
Een groep ASP-bestanden die samenwerken om een bepaald doel te bereiken, wordt een toepassing genoemd. Het Application-object wordt gebruikt om deze bestanden aan elkaar te koppelen.
Toepassingsobject
Een toepassing op het web kan bestaan uit verschillende ASP-bestanden die samenwerken om een bepaald doel te bereiken. Het Application-object wordt gebruikt om deze bestanden aan elkaar te koppelen.
Het Application-object wordt gebruikt om variabelen vanaf elke pagina op te slaan en te openen, net als het Session-object. Het verschil is dat ALLE gebruikers EEN Applicatie-object delen (bij Sessions is er EEN Sessie-object voor ELKE gebruiker).
Het toepassingsobject bevat informatie die door veel pagina's in de toepassing zal worden gebruikt (zoals gegevens over de databaseverbinding). De informatie is vanaf elke pagina toegankelijk. De informatie kan ook op één plek worden gewijzigd en de wijzigingen worden automatisch op alle pagina's weergegeven.
De verzamelingen, methoden en gebeurtenissen van het Application-object worden hieronder beschreven:
Collecties
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 |
Methoden:
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) |
Evenementen
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) |