global.asp的内容
<Script Language=Vbscript RUNAt=Server>
Sub Application_OnStart
Application.Lock
set FSO = Server.CreateObject("Scripting.FileSystemObject")
file=Server.MapPath("counter.txt")
if FSO.FileExists(file) = true then
set CTO = FSO.OpenTextFile(file,1,false)
Application("Counter") = CTO.ReadLine
else
Set CTO = FSO.CreateTextFile(file,false,flase)
Application("Counter") = 1
end if
CTO.close
Application.Unlock
End Sub
Sub Session_OnStart
Session.Timeout = 1
Application.Lock
Application("curUsers")=Application("curUsers")+1
Application("Counter") = Application("Counter")+1
Application.Unlock
End Sub
Sub Session_OnEnd
Application.Lock
Application("curUsers")=Application("curUsers")-1
Application.Unlock
End Sub
Sub Application_OnEnd
set FSO=Server.CreateObject("Scripting.FileSystemObject")
set CTO=FSO.OpenTextFile(file,2,false)
CTO.writeline Application("Counter")
CTO.close
End Sub
</script> 作者:
xingdanyinggu 时间: 2006-5-15 11:31
你的FSO组件是否成功,你可以另外建立一个网页写入下面的代码
<%
set FSO=Server.CreateObject("Scripting.FileSystemObject")
set CTO=FSO.OpenTextFile(file,2,false)
CTO.writeline Application("Counter")
CTO.close
%>