Adobe 38040334 - Dreamweaver CS3 User Manual page 522

Pc
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

The virtual path, /jsmith/index.htm, stands in for the physical path,
c:\Inetpub\wwwroot\accounts\users\jsmith\index.htm.
Find a file's physical path with the virtual path
If you work with an ISP, you don't always know the physical path to the files you upload. ISPs typically provide you
with an FTP host, possibly a host directory, and a login name and password. ISPs also specify a URL to view your
pages on the Internet, such as www.plutoserve.com/jsmith/.
If you know the URL, then you can get the file's virtual path—it's the path that follows the server or domain name in
a URL. Once you know the virtual path, you can get the file's physical path on the server using the
The
method takes the virtual path as an argument and returns the file's physical path and filename. Here's
MapPath
the method's syntax:
Server.MapPath("/virtualpath")
If a file's virtual path is /jsmith/index.htm, then the following expression returns its physical path:
Server.MapPath("/jsmith/index.htm")
You can experiment with the
Open an ASP page in Dreamweaver and switch to Code view (View > Code).
1
Enter the following expression in the page's HTML code.
2
<%Response.Write(stringvariable)%>
Use the
method to obtain a value for the
3
MapPath
Here's an example:
<% Response.Write(Server.MapPath("/jsmith/index.htm")) %>
Switch to Design view (View > Design) and enable Live Data (View > Live Data) to view the page.
4
The page displays the physical path of the file on the application server, for example:
c:\Inetpub\wwwroot\accounts\users\jsmith\index.htm
For more information on the
Use a virtual path to connect to a database
To write a DSN-less connection string to a database file located on a remote server, you must know the physical path
to the file. The following example is a typical DSN-less connection string for a Microsoft Access database:
Driver={Microsoft Access Driver (*.mdb)};
DBQ=c:\Inetpub\wwwroot\accounts\users\jsmith\data\statistics.mdb
If you don't know the physical path of your files on the remote server, you can get the path by using the
method in your connection string.
1
Upload the database file to the remote server and make a note of its virtual path—for example,
/jsmith/data/statistics.mdb.
Open an ASP page in Dreamweaver, then open the Databases panel (Window > Databases).
2
3
Click the Plus (+) button on the panel and select Custom Connection String from the menu.
Enter a name for the new connection, without spaces or special characters.
4
5
Enter the connection string and use the
method as follows.
MapPath
stringvariable
method, consult the online documentation that comes with Microsoft IIS.
MapPath
method to supply the DBQ parameter.
MapPath
September 4, 2007
MapPath
argument.
DREAMWEAVER CS3
515
User Guide
method.
MapPath

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents