01.Blogs :
coolfool  
My Tech Space

Server.MapPath Method

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

Syntax: 
      MapPath(Path)

Parameters:

     Path

      Specifies the relative or virtual path to map to a physical directory.
      If Path starts with either a forward (/) or backward slash (\), the MapPath method returns a path as if Path were 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.         

      This method does not check whether the path it returns is valid or exists on the server.
      MapPath is not available to the Session_OnEnd and the Application_OnEnd events.
      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.

Example:

<%= Server.MapPath("data.txt")%><BR>

<%= Server.MapPath("script/data.txt")%><BR>

Use this method to find the physical path to a file on the server, without which the file open event will generate an error that the specified path doesnt exist!

posted on Thursday, January 12, 2006 6:25 PM by coolfool


 
03.UPDATE CALENDAR :
<January 2006>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
2930311234

05.MY LINKS :

07.Subscriptions :

Subscriptions


© Copyright 2005 Microsoft Corporation. All Rights Reserved.
Terms of Use | Privacy Statement | Code of Conduct | Hosted by MaximumASP for Microsoft
WHO-BAR