Adobe Dreamweaver CS3 Manuel d'utilisateur Page 522

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 738
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 521
DREAMWEAVER CS3
User Guide
515
The virtual path, /jsmith/index.htm, stands in for the physical path,
c:\Inetpub\wwwroot\accounts\users\jsmith\index.htm.
Find a files physical path with the virtual path
If you work with an ISP, you dont 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 files 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 files physical path on the server using the
MapPath method.
The
MapPath methodtakesthevirtualpathasanargumentandreturnsthefilesphysicalpathandfilename.Heres
the method’s syntax:
Server.MapPath("/virtualpath")
If a files virtual path is /jsmith/index.htm, then the following expression returns its physical path:
Server.MapPath("/jsmith/index.htm")
You can experiment with the MapPath method as follows.
1 Open an ASP page in Dreamweaver and switch to Code view (View > Code).
2 Enter the following expression in the pages HTML code.
<%Response.Write(stringvariable)%>
3 Use the MapPath method to obtain a value for the stringvariable argument.
Heres an example:
<% Response.Write(Server.MapPath("/jsmith/index.htm")) %>
4 Switch to Design view (View > Design) and enable Live Data (View > Live Data) to view the page.
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 MapPath method, consult the online documentation that comes with Microsoft IIS.
Use a virtual path to connect to a database
TowriteaDSN-lessconnectionstringtoadatabasefilelocatedonaremoteserver,youmustknowthephysicalpath
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 MapPath
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.
2 Open an ASP page in Dreamweaver, then open the Databases panel (Window > Databases).
3 Click the Plus (+) button on the panel and select Custom Connection String from the menu.
4 Enter a name for the new connection, without spaces or special characters.
5 Enter the connection string and use the MapPath method to supply the DBQ parameter.
September 4, 2007
Vue de la page 521
1 2 ... 517 518 519 520 521 522 523 524 525 526 527 ... 737 738

Commentaires sur ces manuels

Pas de commentaire