If the path of an image on a website is http: // localhost: 2008/websit1/images/1.jpg
Websit1 indicates a virtual path or site
In asp.net, if we enter Response. Write (Request. MapPath ("/01.jpg") on the. cs page "));
This can output the physical path of the image, that is, the specific path of the image stored on the server.
Relative Path in HTML
Copy codeThe Code is as follows:
../indicates switching to the upper-level directory http: // localhost: 2008/01. jpg
./or do not fill in the current path http: // localhost: 2008/websit1/01.jpg
/indicates that the root directory returns the website's root directory http: // localhost: 2008/01. jpg
And ~ /It can only be used in asp.net and can only be used in server controls
If it is a site or virtual directory, it indicates the root directory.
Copy codeThe Code is as follows:
Response. Write (Request. MaopPath ("~ /01.jpg") is returned as Response. Write (Request. MapPath ("/01.jpg"); the same physical path