在控制器 ASP.NET MVC 中获取项目根路径? [英] Getting Project Root Path In Controller ASP.NET MVC?
本文介绍了在控制器 ASP.NET MVC 中获取项目根路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为我的 css 使用 dotlesscss,我记得如何使用它,但我忘记了如何获取根项目路径,以便我可以生成到我的 .less 文件的完整文件路径以获取 less 引擎解析.如何获取项目根路径,以便为我的 less 文件生成路径?
I am using dotlesscss for my css and I remember how to use that but what I am forgetting is how to get the root project path so that I can generate the full file path to my .less file to get for the less engine to parse. How do I get the project root path so that I can generate the path for my less files?
推荐答案
Server.MapPath("~");
或:
HostingEnvironment.ApplicationPhysicalPath
这篇关于在控制器 ASP.NET MVC 中获取项目根路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文