【问题标题】:Classic ASP FSO Permission Denied经典 ASP FSO 权限被拒绝
【发布时间】:2014-07-27 08:20:18
【问题描述】:

我试图通过 Classic ASP FSO 组件获取文件列表。

但即使我从远程桌面授予根文件权限(IUSR_domain),我仍然收到此错误。

Microsoft VBScript runtime error '800a0046'

Permission denied

/default2.asp, line 28

<%
fs,fo,x
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("C:\inetpub\vhosts\xx.com\httpdocs\photo\other") <-- line 28
for each x in fo.files
%>
<div id="photos">
<div class="photo"><%Response.write(x.Name & "<br>")%></div>
</div>

<%next
set fo=nothing
set fs=nothing
%>

【问题讨论】:

  • 如果路径确实正确,您将需要确保访问网站的用户上下文至少具有对C:\inetpub\vhosts\xx.com\httpdocs\photo\other 的读取权限。如果您使用匿名访问,设置为 IUSRIUSR_machinename 的帐户是什么(默认值因 IIS 版本而异)?

标签: asp-classic fso


【解决方案1】:

尝试使用 Server.MapPath

例如:

    downloadFileDirectory = Server.MapPath("\httpdocs\photo\other")
          Set fs= CreateObject("Scripting.FileSystemObject")

            If fs.FolderExists(downloadFileDirectory) Then
              Set fo= fs.GetFolder(downloadFileDirectory)
                    for each x in fo.files
                    %>etc.

【讨论】:

  • @r.Taskiran ...这个答案对您有帮助吗?
  • 感谢您的帮助。
  • @r.taskiran 不客气 - 如果它回答了您的问题,那么我可以请您将问题标记为已回答。
  • @allski 这并不能否认他们没有使用他们正在使用的用户上下文获得文件夹权限的事实。如果 OPs 路径正确,MapPath 将无济于事,因为您最终会得到相同的结果,downloadFileDirectory 将是 C:\inetpub\vhosts\xx.com\httpdocs\photo\other,并且他们没有权限的事实仍然存在。
  • @Lankymart - 明白了。谢谢。
【解决方案2】:

将 IUSR_machinename 和 IWAM_machinename 设置为对文件夹具有更改权限。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-12-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-30
    相关资源
    最近更新 更多