蔡鸟问题 关于计数器 请大侠 赐教!
问题: 计数器统计的数据不能存到根目录的相关文件里面
每次服务器重起就得重新开始计数, 我调不出来 请大侠们看看那有问题!
第一次问问题 不知道分够不够 不够在加 ! 求教了
global.asa
<script language="VBScript" runat="server">
sub Application_OnStart
set fs = server.CreateObject("scripting.filesystemobject")
counter_file=Server.MapPath ("/counter.txt")
set txt = fs.opentextfile(counter_file)
Application("counter")=txt.readline
txt.close
end sub
sub Session_OnStart
Application("counter")=Application("counter") + 1
end sub
sub Session_OnEnd
set fs = server.CreateObject("scripting.filesystemobject")
counter_file=Server.MapPath ("/counter")
set txt = fs.createtextfile( counter_file,true)
txt.writeline(Application("counter"))
txt.close
end sub
</script>
index.asp
<%Application.Lock%>
<%=application("counter")%>
<%Application.UnLock%>