Question

i am accessing files in a virtual folder using classic asp by server objects. here is the code for getting the folder:

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

I am getting file not found error when looping through the directory. The files are seen when i put //development/far/ in the browser. I am fairly new to asp so do not know where going wrong.

this is code for when looping through the directory:

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
Was it helpful?

Solution

Just use the path part of your URL when calling Server.MapPath():

mapPath = Server.MapPath("/far/")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top