please dont rip this site


The MapPath method maps the specified relative or virtual path to the corresponding physical directory on the server.


Server.MapPath( path )



Specifies the relative or virtual path to map to a physical directory. If path starts with either a forward or backward slash, either (/) or (\), the MapPath method returns a path as if path is a full virtual path. If path doesn’t start with a slash, the MapPath method returns a path relative to the directory of the .asp file being processed.

Note The path parameter can contain relative paths (../../Scripts/, for example) if the EnableParentPath registry setting is set to TRUE. This is the default setting.

For more information about registry entries, see Configuring Registry Entries in the Active Server Pages Scripting Guide.


The MapPath method does not check whether the path it returns is valid or exists on the server.

Because the MapPath method maps a path regardless of whether the specified directories currently exist, you can use the MapPath method to map a path to a physical directory structure, and then pass that path to a component that creates the specified directory or file on the server.


For the examples below, the file Data.txt is located in the directory, C:\Inetpub\Wwwroot\Script, as is the Test.asp file that contains the following scripts. The C:\Inetpub\Wwwroot directory is set as the server's home directory.

The following example uses the server variable PATH_INFO to map the physical path of the current file. The following:

<%= server.mappath(Request.ServerVariables("PATH_INFO"))%><BR>

produces the output:


Because the path parameters in the following examples do not start with a slash character, they are mapped relative to the current directory, in this case C:\Inetpub\Wwwroot\Script. The following scripts:

<%= server.mappath("data.txt")%><BR>
<%= server.mappath("script/data.txt")%><BR>

produce the following output:


The next two examples use the slash characters to specify that the path returned should be looked up as complete virtual paths on the server. The following scripts:

<%= server.mappath("/script/data.txt")%><BR>
<%= server.mappath("\script")%><BR>

produce the following output:


The following examples demonstrate how you can use either a forward slash (/) or a backslash (\) to return the physical path to the home directory. The following scripts:

<%= server.mappath("/")%><BR>
<%= server.mappath("\")%><BR>

produce the following output:


Applies To

Server Object

© Microsoft Corporation. All rights reserved.

file: /Techref/language/asp/obj/introbj_36.htm, 4KB, , updated: 1996/11/21 19:01, local time: 2024/5/27 14:44,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> MapPath</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!