Server.MapPath得到的路径都是服务器上的物理路径,也就是常说的绝对路径服务器
./当前目录
/网站主目录
../上层目录
~/网站虚拟目录post
一、Server.MapPath("/")网站
注:得到应用程序根目录所在的位置,如 C:\Inetpub\wwwroot\。blog
二、Server.MapPath("./")程序
注:得到所在页面的当前目录,等价于Server.MapPath("")。di
三、Server.MapPath("../")
注:得到所在页面的上级目录。
四、Server.MapPath("~/")
注:得到当前应用级程序的目录,若是是根目录,就是根目录,若是是虚拟目录,就是虚拟目录所在的位置,如C:\Inetpub\wwwroot\Example\。