< SCRipT LANGUAGE=VBScript RUNAT=Server > Sub Application_OnStart Application("SessionCount") = 0 End Sub
Sub Session_OnStart Application.Lock Application("SessionCount") = Application("SessionCount") + 1 Application.Unlock If Application("SessionCount") > 100 Then Application.Lock Application("SessionCount") = 0 Application.Unlock '' Here you would put any code you need to run '' do not surround the code with < % % > tags '' For example you might run a database query that checks for expired accounts End if End Sub < /SCRIPT >
< SCRIPT LANGUAGE=VBScript RUNAT=Server > Sub Application_OnStart Application("SessionCount") = 0 End Sub
Sub Session_OnStart Application.Lock Application("SessionCount") = Application("SessionCount") + 1 Application.Unlock
If Application("SessionCount") > 15 Then Application.Lock Application("SessionCount") = 0 Application.Unlock Set ObjMyFile = CreateObject("Scripting.FileSystemObject") Set OpenMyFile = ObjMyFile.OpenTextFile(Server.MapPath("last-update.txt")) MyFileValue = OpenMyFile.ReadLine OpenMyFile.Close If DateDiff("h",MyFileValue,NOW) > 6 Then '' Here you would put any code you need to run '' do not surround the code with < % % > tags '' For example you might run a database query that checks for expired accounts Set WriteMyFile = ObjMyFile.CreateTextFile(Server.MapPath("last-update.txt")) WriteMyFile.WriteLine(NOW) WriteMyFile.Close End if End If End Sub < /SCRIPT >