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?
1 Answer
Server.MapPath("~");
or:
HostingEnvironment.ApplicationPhysicalPath
4 Comments
ahmd0
Better use
HostingEnvironment.ApplicationPhysicalPath because HttpContext.Current.Server can be null in some circumstances -- for instance, if called from a spawned worker thread.DCShannon
HostingEnvironment.ApplicationPhysicalPath is in the System.Web.Hosting namespace.Munam Yousuf
if Server.MapPath doesn't work. Try System.Web.HttpContext.Current.Server.MapPath(saveAsLocation)
Dagrooms
Is there any way to add this code to a Web.Config file?