Oct 30, 2007

Get Physical File Path, Virtual Directory

oFSO = Server.CreateObject("Scripting.FileSystemObject")
sPath = Server.MapPath("Moozik\")
fRoot = oFSO.GetFolder(sPath)


(web paths, not full physical)

My file: /Test/Myfile.aspx
Virtual directory: /Test/VirtualDir/
Code: Server.MapPath("VirtualDir/")

or if you are in a higher directory:

MyFile: /Test/Something/MyFile.aspx
Virutal: /VirtualDir/
Code: Server.MapPath("../../VirtualDir/")

You are probably just getting the virtual path (the one that gets sent into
MapPath) wrong.

No comments:

Post a Comment