江如下代码保存到Global.asa文件中,放在网站根目录下就OK了!
<Script Language=VBScript RunAt=Server>
Sub Application_OnStart
Dim Counter
Dim DSNPath
Set fso = CreateObject("Scripting.FileSystemObject")
Set AOSR = fso.OpenTextFile("绝对路径\Counter.txt",1,True ,0)
Counter = AOSR.ReadLine
AOSR.Close
Set AOSR=nothing
Set fso=nothing
Application("Count")=Counter
End Sub
Sub Session_OnStart
Session.TimeOut=15
Application.Lock
Application("Count")=Application("Count")+1
Application.UnLock
End Sub
Sub Session_OnEnd
End Sub
Sub Application_OnEnd
Application.Lock
Set fso = CreateObject("Scripting.FileSystemObject")
Set AOEW = fso.OpenTextFile("绝对路径\Counter.txt",2,True)
AOEW.WriteLine Application("Count")
AOEW.Close
Set AOEW=nothing
Set fso=nothing
Application.UnLock
End Sub
</Script>