不好的做法:
whichfile="D:\inetpub\wwwroot\whatever\junk.txt"
set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
采用Server.MapPath的做法:
whichfile=
server.mappath("\whatever\junk.txt")
set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
转载于:https://www.cnblogs.com/missthe/archive/2007/12/21/1008837.html