2012-12-10 39 views
1

我正在使用服務器對象的傳統asp訪問虛擬文件夾中的文件。這裏是獲取文件夾的代碼:通過虛擬目錄訪問經典asp時無法找到文件

Set FSO = Server.CreateObject("Scripting.FileSystemObject") 
Dim mapPath 
mapPath = Server.MapPath("http://development/far/") 
Set farFolder = FSO.GetFolder(mapPath) 

我收到文件找不到錯誤,當循環目錄時。當我把//開發/遠/在瀏覽器中時,可以看到這些文件。我對asp相當陌生,所以不知道哪裏出了問題。

這是通過目錄循環時,下面的代碼:

For Each item in farFolder.Files 

Set matches = re.Execute(item.Name) 
if(matches.Count=1) then 
Response.Write ("<a target=""_blank""href=""" & item.Path & """>" & item.Name & "</a> <br>") 
End if 

Next 
+0

告訴我們,環目錄和生成文件的代碼未發現錯誤。 –

回答

1

只要用你的URL的路徑部分調用Server.MapPath()時:

mapPath = Server.MapPath("/far/") 
+0

亞..那件事情起作用 – pbd