Showing posts with label Server.MapPath. Show all posts
Showing posts with label Server.MapPath. Show all posts

Wednesday, 15 June 2011

ASP: the Server.MapPath method

   


The Server.MapPath method is used to obtain the relative or virtual path to map a physical folder. How many times did we use it? Did we fully understand how it works?
Well, let's get into it and see.

The syntax
The basic syntax of the method is:
Server.MapPath(path)
where path is the relative or virtual path to map a physical folder. The parameter is required. When you use the method in an asp page, the page path will be affecting the output produced. If the path parameter start with a backslash or a slash, the method will return a path relative to the path where the asp page containing the method is located.

Friday, 8 October 2010

ASP: Scripting.FileSystemObject... show folder content

   


This is the last post of the Scripting.FileSystemObject series. After seeing how to manipulate files and folders, how to upload files and how to get file information, I would like to show how to retrieve a folder's content. This is probably the most easy thing to do, and as usual we start by setting the variables and the object:
<%
Dim FSO
   Set FSO = Server.CreateObject("Scripting.FileSystemObject")
   Dim folderpath
   folderpath = Server.MapPath(yourfolder)