Getting Project Root Path In Controller ASP.NET MVC?

ryanzec picture ryanzec · Mar 5, 2011 · Viewed 69.9k times · Source

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?

Answer

Darin Dimitrov picture Darin Dimitrov · Mar 5, 2011
Server.MapPath("~");

or:

HostingEnvironment.ApplicationPhysicalPath