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)文章
SqlCommandBuilder類批量更新excel或者CSV數(shù)據(jù)的方法
這篇文章主要介紹了SqlCommandBuilder類批量更新excel或者CSV數(shù)據(jù)的方法,需要的朋友可以參考下2015-10-10asp.net Repeater取得CheckBox選中的某行某個值的c#寫法
asp.net(c#)利用Repeater取得CheckBox選中行的某個值的代碼2008-08-08ASP.NET MVC中使用jQuery時的瀏覽器緩存問題詳解
這篇文章主要介紹了ASP.NET MVC中使用jQuery時的瀏覽器緩存問題詳解,需要的朋友可以參考下。2016-06-06ASP.NET Core MVC學習教程之路由(Routing)
這篇文章主要給大家介紹了關(guān)于ASP.NET Core MVC學習教程之路由(Routing)的相關(guān)資料,文中通過示例代碼介紹的非常詳細,對大家學習或者使用ASP.NET Core MVC具有一定的參考學習價值,需要的朋友們下面來一起學習學習吧2019-07-07.net 通過URL推送POST數(shù)據(jù)具體實現(xiàn)
這篇文章主要介紹了.net 通過URL推送POST數(shù)據(jù)具體實現(xiàn),有需要的朋友可以參考一下2013-12-12ASP.NET Core 2.0 使用支付寶PC網(wǎng)站支付實現(xiàn)代碼
這篇文章主要介紹了ASP.NET Core 2.0 使用支付寶PC網(wǎng)站支付實現(xiàn)代碼,需要的朋友可以參考下2017-10-10