Summarize the usage of Server.MapPath

Source: Internet
Author: User
When learning ASP, I summarized the usage syntax of Server.MapPath: Server.MapPath (path) ' path for you to specify the path purpose: To translate the virtual path specified by path into the actual path

LearnASPThe Server.MapPath of the time, the use of their own summary

Syntax: Server.MapPath (PATH) ' path for you to specify the paths
Purpose: To convert the virtual path specified by path to the actual path
Example:
1) server.mappth ("page.asp") ' Find the actual path of the page page.asp
2) server.mappth ("/") ' Find the root directory
3) Server.MapPath ("./") "Find out the current directory (note: Many books are written in this, but write their own after the hint is wrong)

Attention: Parameter path must be a virtual path, otherwise there will be an error!

Example:
If you currently invoke the Server.MapPath page as: http://www.xxx.com/putinfo/test.asp, and you save the file in Http://www.xxx.com/putinfo/img, You can use either of the following two methods:
1) path= "/putinfo/img"
2) path= "IMG"

That is, if the first character of path is "/" or "\", then Server.MapPath interprets it as a path that starts at the root directory, otherwise Server.MapPath interprets it as a path starting from the current directory.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.