1

サーバー オブジェクトによる従来の ASP を使用して、仮想フォルダー内のファイルにアクセスしています。フォルダを取得するためのコードは次のとおりです。

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

ディレクトリをループすると、ファイルが見つからないというエラーが発生します。//development/far/ をブラウザーに入れると、ファイルが表示されます。私は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
4

1 に答える 1

1

Server.MapPath()を呼び出すときに、URL のパス部分を使用するだけです。

mapPath = Server.MapPath("/far/")
于 2012-12-10T23:18:50.877 に答える