Use common path

 ./ current directory
/ home directory site
../ parent directory
~ / site virtual directory

if the current directory to the site E: \ wwwroot application virtual directory to E: \ wwwroot \ company pages viewed path for the E: \ wwwroot \ company \ news \ show.asp
in show.asp page
Server.MapPath ( "./") return path is: E: \ wwwroot \ Company \ News
Server.MapPath ( "/") return path is: E: \ wwwroot
server.MapPath ( "../") as a return path: E: \ wwwroot \ Company
the server.MapPath ( "~ /") is a return path: E: \ wwwroot \ Company
server.MapPath (Request.ServerVariables ( "Path_Info" )) 
the Request.ServerVariables ( "PATH_TRANSLATED")  
in two ways above return path D: \ wwwroot \ company \ news \ show.asp

Reproduced in: https: //my.oschina.net/garyun/blog/602759

Guess you like

Origin blog.csdn.net/weixin_33727510/article/details/91774051