fso.GetFolder(Server.MapPath()) returns full path, not relative path to image
Posted on 2005-04-18
I am using rootFolder to get the path for images in a directory which i am displaying via ASP.
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set rootFolder = fso.GetFolder(Server.MapPath("images/thumbails/")) ' Here point to you folder.
Unfortunatley, i only just noticed that rootFolder returns the full path on the server. i.e. C:\inetsrv\wwwroot\website1\images\thumbnails\
as opposed to a relative path to the asp page: \images\thumbnails
this results in lots of broken links when i load the page up in a browser a machine other than the server, because all the images are pointing to the whole C:\ path not the relative path for the images on the server.
Is there any clean way i can fix this?