将 UNC 路径与经典 ASP FileSystemObject 一起使用
根据网站,我发现下面的代码应该可以工作。如果我将路径更改为 C:\whats_new.txt 它就可以正常工作。
Const Filename = "\\SCPAFS1PW\returns\whats_new.txt" ' file to read
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
' Create a filesystem object
Dim FSO
set FSO = server.createObject("Scripting.FileSystemObject")
' Map the logical path to the physical system path
Dim Filepath
Filepath = Filename
if FSO.FileExists(Filepath) Then <--This always returns false
According to the websites I could find the below code should work. If I change the path to C:\whats_new.txt it works just fine.
Const Filename = "\\SCPAFS1PW\returns\whats_new.txt" ' file to read
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
' Create a filesystem object
Dim FSO
set FSO = server.createObject("Scripting.FileSystemObject")
' Map the logical path to the physical system path
Dim Filepath
Filepath = Filename
if FSO.FileExists(Filepath) Then <--This always returns false
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
系统提示该文件不存在。事实上,这实际上是一个权限问题。微软设计了这个错误,这样如果您没有权限,您就无法找出文件夹上的文件名。
我修改了对该目录的权限,并且能够使用 UNC 路径访问它。
The system reports the file does not exist. In fact it was actually a permissions issue. Microsoft designed the error so that if you do not have permission you cannot fish to figure out file names on a folder.
I modified my permisions to the directory and I was able to access it using a UNC path.
asp Classic 不(默认情况下)使用应用程序池 ID 进行身份验证 -
要设置 iis 的用户名,请按照下列步骤操作:
在 IIS 上选择您要更改的网站/应用程序:
双击身份验证
单击“匿名身份验证”,然后单击“编辑”
您可以设置特定用户或选择应用程序池身份
asp Classic does not (by default) use the Application Pool id for authentication -
To set the username for iis follow these steps:
on IIS select the website / application you wish to change:
Double Click on Authentication
Click on Anonymous Authentication and then click edit
You can either set a specific user or select the Application pool identity