获取站点根目录:

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

  

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2021-07-05
  • 2022-02-16
  • 2022-02-07
  • 2021-09-28
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
相关资源
相似解决方案