這篇文章主要介紹了asp.net獲取網站目錄物理路徑的方法,需要的朋友可以參考下
頁面后臺cs文件的相對網站根目錄的路徑/view/Atlas 代碼如下:string rootPath1= Server.MapPath("~"); string rootPath2 = Request.ApplicationPath; string path1 = Server.MapPath("upload"); string path2 = Server.MapPath(""); string path3 = Server.MapPath("."); string path4 = Server.MapPath(".."); string path5 = Server.MapPath(Request.ServerVariables["PATH_INFO"]); 結果 代碼如下:string rootpath1= "F:ASP.NET_Projects超凡裝飾cfzsWebcfzsWeb"; string rootpath2= "/Web"; string path1 = "F:ASP.NET_Projects超凡裝飾cfzsWebvie新聞熱點
疑難解答