Tema: Update...
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 24/01/2002, 09:32
Avatar de Aston
Aston
 
Fecha de Ingreso: mayo-2001
Ubicación: Madrid
Mensajes: 933
Antigüedad: 24 años
Puntos: 0
Re: Update...

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

Syntax
Server.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 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.
Remarks
The MapPath method does not support relative path syntax (.) or (..). For example, the following relative path, ../MyDir/MyFile.txt, returns an error.

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.

Examples
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 script

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

produces the output

c:\inetpub\wwwroot\script\test.asp<BR>

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&gt ;
<%= server.mappath("script/data.txt")%><BR>

produce the following output

c:\inetpub\wwwroot\script\data.txt<BR>
c:\inetpub\wwwroot\script\script\data.txt<BR&gt ;

--> Continúa

<a href="http://www.laventanita.net/" target="_blank">
<img src="http://www.breogan.org/images/Aston.gif" border="0" alt="La Ventanita.net - Lo imprescindible en la red"></a>