1. 首頁
  2. »
  3. 網頁開發
  4. »
  5. ASP.NET
  6. »
  7. [.NET] Server.MapPath抓取主機路徑

[.NET] Server.MapPath抓取主機路徑

2008/12/19
▪ ServerPath.cs的code protected void Page_Load(object sender, EventArgs e) { Response.Write("根目錄:" + Server.MapPath("~\\") + "<BR>"); Response.Write("檔案目前位置:" + Server.MapPath(".\\") + "<BR>"); } [範例下載]

▪ ServerPath.cs的code
protected void Page_Load(object sender, EventArgs e)
 {
  Response.Write("根目錄:" + Server.MapPath("~\\") + "<BR>");
  Response.Write("檔案目前位置:" + Server.MapPath(".\\") + "<BR>");
 }


[範例下載]