IIS站點下多應用程序 C#獲取根目錄方法


獲取站點根目錄:

Server.MapPath(Request.ServerVariables["PATH_INFO"])
Server.MapPath("/")
Server.MapPath("")//當前代碼文件所在的目錄路徑
Server.MapPath(".")
Server.MapPath("../")
Server.MapPath("..")

  

獲取應用程序根目錄:

// 獲取程序的基目錄。
System.AppDomain.CurrentDomain.BaseDirectory

// 獲取和設置包括該應用程序的目錄的名稱。
System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM