MapPath

Description

Maps a relative or virtual path to a physical path on the server. This method is available to ASP targets only.

Applies to

PSServerClass object

Syntax

psServer.MapPath( path )

Argument

Description

path

The relative or virtual path to map to a physical directory. If the path argument starts with either a forward or backward slash, MapPath returns the physical path that corresponds to this virtual path. If the path argument does not start with a slash, MapPath returns a physical path relative to the directory where the current server page is located.

Returns

Returns a physical path on the server.

Usage

At runtime, MapPath calls the MapPath method of the Server object.

Examples

Example 1

The following example specifies a relative path as an argument to MapPath. If the current server page is located in C:\WEBSERVER\SCRIPTS, this call to MapPath returns C:\WEBSERVER\SCRIPTS\SERVER\MYFILE.ASP:

file = psServer.MapPath("scripts\myfile.asp");

The following example specifies a full virtual path as an argument to MapPath. Assuming that the server's home directory is C:\WEBSERVER, this call to MapPath returns C:\WEBSERVER\GRAPHICS\MYFILE.GIF:

file = psServer.MapPath("/graphics/myfile.gif");