ASP Session_OnStart en Session_OnEnd-gebeurtenissen

Session Object Referentie Handleiding

Definitie en gebruik

Session_OnStart Gebeurtenis

De Session_OnStart-gebeurtenis vindt plaats wanneer de server een nieuwe sessie maakt.

Dit evenement wordt geplaatst in het Global.asa-bestand.

Session_OnEnd Gebeurtenis

De Session_OnEnd-gebeurtenis vindt plaats aan het einde van de sessie. (Wanneer de sessie wordt opgegeven of overschreden).

Dit evenement wordt geplaatst in het Global.asa-bestand.

Opmerking:De MapPath-methode kan niet worden gebruikt in de Session_OnEnd-code.

Syntaxis

<script language="vbscript" runat="server">
Sub Session_OnStart
... 
Einde Sub
Sub Session_OnEnd
... 
Einde Sub
</script>

Voorbeeld

Global.asa:

<script language="vbscript" runat="server">
Sub Application_OnEnd()
Application("totvisitors")=Application("visitors")
Einde Sub
Sub Application_OnStart
Application("visitors")=0
Einde Sub
Sub Session_OnStart
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
Einde Sub
Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
Einde Sub
</script>

Toon het huidige aantal bezoekers in ASP-bestanden:

<html>
<head>
</head>
<body>
<p>
Er zijn <%response.write(Application("bezoekers"))%> online!
online nu!
</p>
</body>
</html>

Session Object Referentie Handleiding