Adobe Dreamweaver CC 2015 Manuel d'utilisateur Page 557

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 700
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 556
550
Dynamic sites, pages and web forms
Last updated 6/3/2015
Understanding physical and virtual paths
After using Dreamweaver to upload your files to a remote server, the files reside in a folder in the server’s local directory
tree. For example, on a server running Microsoft IIS, the path to your home page could be as follows:
c:\Inetpub\wwwroot\accounts\users\jsmith\index.htm
This path is known as the physical path to your file.
The URL to open your file, however, does not use the physical path. It uses the name of the server or domain followed
by a virtual path, as in the following example:
www.plutoserve.com/jsmith/index.htm
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 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 files virtual path—its 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 method takes the virtual path as an argument and returns the files physical path and filename. 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 Live view (View > Live View) 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
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
Vue de la page 556
1 2 ... 552 553 554 555 556 557 558 559 560 561 562 ... 699 700

Commentaires sur ces manuels

Pas de commentaire