總注:Server.MapPath獲得的路徑都是服務器上的物理路徑,也就是常說的絕對路徑
1、Server.MapPath("/")
注:獲得應用程序根目錄所在的位置,如 C:\Inetpub\wwwroot\。
2、Server.MapPath("./")
注:獲得所在頁面的當前目錄,等價於Server.MapPath("")。
3、Server.MapPath("../")
注:獲得所在頁面的上級目錄。
4、Server.MapPath("~/")
注:獲得當前應用級程序的目錄,如果是根目錄,就是根目錄,如果是虛擬目錄,就是虛擬目錄所在的位置,如C:\Inetpub\wwwroot\Example\。