【问题标题】:httpcontext current server mappath shows c:\inetpub\wwwroot when the current location is somewhere else当当前位置在其他地方时,httpcontext current server mappath 显示 c:\inetpub\wwwroot
【发布时间】:2013-07-24 19:38:25
【问题描述】:

我在 VS 2008 中接受了另一个开发人员的 MVC 项目,我需要知道为什么 HttpContext.Current.Server.MapPath("/")c:\inetpub\wwwroot

我正在从c:\Websites\Customer\Web\Website\Application\ 运行项目

IIS 显示该站点正在从:c:\Websites\Customer\Web\Website\Application\ 运行,所以我非常困惑。

有什么想法吗?

【问题讨论】:

    标签: asp.net-mvc visual-studio-2008 iis mappath


    【解决方案1】:

    使用Server.MapPath("~"),它返回应用程序的根目录的物理路径。

    您使用的Server.MapPath("/"),返回的根目录的物理路径。

    【讨论】:

      猜你喜欢
      • 2013-03-27
      • 2015-08-09
      • 2015-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-10
      相关资源
      最近更新 更多