刚回看贴子,看到此贴时,突然想在统计在线人数的问题。
便想可不可用同样方式global.asa来实现楼主的想法,
搜索了一下,还真找到了相关内容,如下,楼主自已看看能否做得成,
很久没写过,IIS也没装,你自已看着能不能实现了:
<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>