在Server.CreateObject("Scripting.FileSystemObject")中创建要在GetFolder中使用的虚拟目录IIS7. [英] Create Virtual Directory IIS7 to be use in GetFolder in Server.CreateObject("Scripting.FileSystemObject")
问题描述
我试图在IIS7上创建一个虚拟目录,然后在以下代码中使用该虚拟目录
I am trying to create a virtual directory at my IIS7 and then use the virtual directory in the following code
sPath = "\CMapped\database\attendanceData\"
sDir = Server.MapPath(".") & sPath
response.write sDir
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set obj_FolderBase = fso.GetFolder(sDir)
response.end
但是我遇到了以下错误:
But I got the following error:
-
我创建了虚拟目录,并将路径设置为C:\ Drive.我的本地主机在D:\驱动器上.我还设置了Connect as,并输入了我的登录名和密码.我是PC的管理员.一切授权.
I created the virtual directory and set the path to C:\ Drive. My localhost is at D:\ drive. I have also set Connect as and entered my log in and password. I am the administrator of the PC. Everything authorized.
然后我转到C:并将其设置为共享文件夹
Then I go to C: and set it as a shared folder
我回到IIS,然后单击虚拟目录->托管虚拟目录->浏览.我成功连接到目录
I went back to IIS and click on the virtual directory -> Managed Virtual Directory -> Browse. I successfully connect to the directory
sPath = "\CMapped\database\attendanceData\"
sDir = Server.MapPath(".") & sPath
response.write sDir
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set obj_FolderBase = fso.GetFolder(sDir)
response.end
目录结构
推荐答案
您要尝试的操作将在href
或src
属性中使用,或与
What you are trying would work in an href
or src
attribute, or with
<!--#include virtual="\CMapped\database\attendanceData\yourfile.asp"-->
.
使用server.mappath
,尽管我认为您需要在计算机上使用物理目录结构.由于您的虚拟目录位于其他驱动器上,因此建议您使用
With server.mappath
though I think you need to use the physical directory structure on the machine. As your virtual directory is on a different drive I suggest you go with
sDir = "C:\full_physical_path_to\database\attendanceData\"
这篇关于在Server.CreateObject("Scripting.FileSystemObject")中创建要在GetFolder中使用的虚拟目录IIS7.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!