为什么一设计到server端的文件读写,ASP程序就运行不了?
<%
Function Counts(CounterFile)
Dim objFSO, objTS
Application.Lock '锁定Application对象
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
Set objTS = objFSO.OpenTextFile(Server.MapPath(CounterFile), 1, True)
If Not objTS.AtEndOfStream Then '检查是否到达文件结尾
Counts = CLng(objTS.ReadLine)
End If
Counts = Counts + 1
objTS.Close
Set objTS = objFSO.OpenTextFile(Server.MapPath(CounterFile), 2, True)
objTS.WriteLine(Counts)
objTS.Close
Application.Unlock '解除锁定
End Function
%>
<HTML>
<BODY>
你是第<%= Counts("Counter.txt"
%> 位访客
</BODY>
</HTML>