In the use of Server.MapPath (), there are a lot of parameters, what absolute path ah, relative path Ah, these are not complicated but easily confusing things, here will he do a collation.
Copy Code code as follows:
./Current Directory
/Site Home Directory
.. /Upper Directory
~/Web Site Virtual directory
If the current site directory is E:\wwwroot
Application virtual directory for E:\wwwroot\company
The page path to browse is E:\wwwroot\company\news\show.asp
Using in the Show.asp page
Copy Code code as follows:
Server.MapPath ("./") return path is: E:\wwwroot\company\news
Server.MapPath ("/") return path is: E:\wwwroot
Server.MapPath (".. /") return path is: E:\wwwroot\company
Server.MapPath ("~/") returns the path: E:\wwwroot\company
Server. MapPath (Request. ServerVariables ("Path_info"))
Request.ServerVariables ("path_translated")
The above two ways return the path to D:\wwwroot\company\news\show.asp