获取项目的根路径在控制器ASP.NET MVC? [英] Getting Project Root Path In Controller ASP.NET MVC?

查看:128
本文介绍了获取项目的根路径在控制器ASP.NET MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用dotlesscss对我的CSS,我记得如何使用,但我忘了我是如何得到根项目路径,以便我可以生成我.LESS文件的完整的文件路径来获取较少引擎解析。我如何获得项目的根路径,这样我可以为我的少文件的路径?


解决方案

 使用Server.Mappath(〜);

  HostingEnvironment.ApplicationPhysicalPath

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("~");

or:

HostingEnvironment.ApplicationPhysicalPath 

这篇关于获取项目的根路径在控制器ASP.NET MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆