天地1号客服电话:计数器急救

来源:百度文库 编辑:高考问答 时间:2024/04/30 17:57:10
我的ASP计数器代码是
<%
CountFile=Server.MapPath("simplecounter.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)
counter=Out.ReadLine
Out.Close
SET FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.CreateTextFile(CountFile,true,FALSE)
Application.lock
counter= counter + 1
Out.WriteLine(counter)
Application.unlock
Response.Write("您是第")
Response.Write("<font color=red>")
Response.Write(counter)
Response.Write("</font>")
Response.Write("位访问者")
Out.Close
%>
但运行时显示如下错误:
错误类型:
Microsoft VBScript 运行时错误 (0x800A0046)
没有权限
/计数器/计数器.asp, 第 8 行
大家帮忙问问因改具体怎么改 啊
谢谢

改成下面这样:
<%
CountFile=Server.MapPath("simplecounter.txt")
Set FileObject=Server.CreateObject("Scripting.FileSystemObject")
Set Out=FileObject.OpenTextFile(CountFile,1,FALSE,FALSE)
counter=Out.ReadLine
Out.Close
Set Out = Nothing ' 这一行最好也加上
'SET FileObject=Server.CreateObject("Scripting.FileSystemObject") ' 把这行去掉
Set Out=FileObject.CreateTextFile(CountFile,true,FALSE)
Application.lock
counter= counter + 1
Out.WriteLine(counter)
Application.unlock
Response.Write("您是第")
Response.Write("<font color=red>")
Response.Write(counter)
Response.Write("</font>")
Response.Write("位访问者")
Out.Close
SET Out = Nothing ' 加上这行
SET FileObject = Nothing ' 加上这行
%>

把“写入”权限打开

这个写法太沟施了

属于权限问题,咨询管理员是否运行写,或者看IIS下该目录是否运行写??

服务器不支持写权限, 不是程序问题