asp.net獲取網(wǎng)站目錄物理路徑示例
更新時間:2014年02月12日 11:08:25 作者:
這篇文章主要介紹了asp.net獲取網(wǎng)站目錄物理路徑的方法,需要的朋友可以參考下
頁面后臺cs文件的相對網(wǎng)站根目錄的路徑/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"]);
結(jié)果
string rootpath1= "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\cfzs\\Web";
string rootpath2= "/Web";
string path1 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\upload\\cfzs\\Web\\view\\Atlas\\upload";
string path2 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas";
string path3 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas";
string path4 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\cfzs\\Web\\view";
string path5 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\Add.aspx\\cfzs\\Web\\view\\Atlas\\Add.aspx";
復制代碼 代碼如下:
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"]);
結(jié)果
復制代碼 代碼如下:
string rootpath1= "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\cfzs\\Web";
string rootpath2= "/Web";
string path1 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\upload\\cfzs\\Web\\view\\Atlas\\upload";
string path2 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas";
string path3 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\cfzs\\Web\\view\\Atlas";
string path4 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\cfzs\\Web\\view";
string path5 = "F:\\ASP.NET_Projects\\超凡裝飾\\cfzs\\Web\\view\\Atlas\\Add.aspx\\cfzs\\Web\\view\\Atlas\\Add.aspx";
相關(guān)文章
Xamarin.Forms在安卓機上進行本機調(diào)試
這篇文章介紹了Xamarin.Forms在安卓機上進行本機調(diào)試的方法,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧2022-02-02
asp.net錯誤捕獲(錯誤處理)page_error事件使用方法
Page_Error事件提供了一種捕獲頁面級錯誤的方法。對于錯誤的處理,您可以只是顯示錯誤信息(正如下面的示例代碼所示),也可以記錄事件或執(zhí)行某個其他操作2014-01-01
Asp.net中使用Sqlite數(shù)據(jù)庫的方法
Sqlite是最近比較流行的數(shù)據(jù)庫了,擁有比Access高效快速,易操作易實施。完全不需要在客戶端進行任何的配置,只需要在站點中引用入DLL文件即可使用了。2009-11-11

