文件显示的问题

怎么能把服务器上某路径下的txt文件显示在web浏览器上?
最好有一些代码,先谢谢了。
---------------------------------------------------------------

dim objFSO,objCountFile,FiletempData
Set objFSO=Server.CreateObject("scripting.FileSystemObject")
Set objCountFile=objFSO.OpenTextFile(Server.MapPath(filename),1,true)
FSOFileRead=objCountFile.ReadAll
response.write fosfileread
objCountFile.Close
Set objCountFile=Nothing
Set objFSO=Nothing
---------------------------------------------------------------

其实把链接直接指向txt文件就能用浏览器打开
---------------------------------------------------------------

Set objFSO = CreateObject("Scripting.FileSystemObject")
//获取文件名
strOpenFileName = InputBox("Please enter the file name for your script ")
Set objFile = objFSO.OpenTextFile(strOpenFileName)
FileRead=objFile.ReadAll
response.write fileread
objFile.Close
Set objFile=Nothing
Set objFSO=Nothing

---------------------------------------------------------------

在ie中就可以自动打开的

Published At
Categories with Web编程
comments powered by Disqus