Sub Application_Onstart
filepath=request.ServerVariables("appl_physical_path")‘这句不对,如何改
filename="filepath&count/counter.txt"
set fs=createobject("scripting.filesystemobject")
if not fs.fileexists(filename) then
fs.createtextfile(filename)
set f=fs.getfile(filename)
s=0
Set ts = f.OpenAsTextStream(2, -2)
ts.writeline(cstr(s))
ts.close
else
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(1, -2)
s=ts.readline
ts.close
end if
application.lock
application("visitor")=s
application.unlock
end sub
如果一个不在根目录下的asp文件(F:/projectDir/manage/manage.asp),第一个被请求,执行global.asa 文件中的filepath=server.mappath(count/counter.txt)时,filepath=?
物理路径:filepath=server.mappath(request.servervariables("path_info"))
相对路径:filepath=server.mappath("count/counter.txt")
filepath=request.ServerVariables("appl_physical_path")‘这句不对,如何改
filename="filepath&count/counter.txt"
set fs=createobject("scripting.filesystemobject")
if not fs.fileexists(filename) then
fs.createtextfile(filename)
set f=fs.getfile(filename)
s=0
Set ts = f.OpenAsTextStream(2, -2)
ts.writeline(cstr(s))
ts.close
else
set f=fs.getfile(filename)
Set ts = f.OpenAsTextStream(1, -2)
s=ts.readline
ts.close
end if
application.lock
application("visitor")=s
application.unlock
end sub
如果一个不在根目录下的asp文件(F:/projectDir/manage/manage.asp),第一个被请求,执行global.asa 文件中的filepath=server.mappath(count/counter.txt)时,filepath=?
物理路径:filepath=server.mappath(request.servervariables("path_info"))
相对路径:filepath=server.mappath("count/counter.txt")