When using Server.MapPath(), there are many parameters, such as absolute paths and relative paths. These things that are not complicated but are easy to confuse. Here is a sorting out them.
The code copy is as follows:
./Current directory
/ Website home directory
../Upper Directory
~/Website virtual directory
If the current website directory is E:/wwwroot
The application virtual directory is E:/wwwroot/company
The page path to browse is E:/wwwroot/company/news/show.asp
Use in show.asp page
The code copy is as follows:
Server.MapPath("./") The return path is: E:/wwwroot/company/news
Server.MapPath("/") The return path is: E:/wwwroot
Server.MapPath("../") The return path is: E:/wwwroot/company
Server.MapPath("~/") The return path is: E:/wwwroot/company
server.MapPath(request.ServerVariables("Path_Info"))
Request.ServerVariables("Path_Translated")
The return paths of the above two methods are D:/wwwroot/company/news/show.asp