Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Project Root Path In Controller ASP.NET MVC?

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?

like image 694
ryanzec Avatar asked Mar 05 '11 12:03

ryanzec


People also ask

How do I get the root path in .NET core?

The Application Base (Root) path is available in the ContentRootPath property of the interfaces IHostingEnvironment (. Net Core 2.0) and IWebHostEnvironment (. Net Core 3.0) in ASP.Net Core. The IHostingEnvironment is an interface for .

What is ContentRootPath and Webrootpath?

The content root path is the absolute path to the directory that contains the application content files. The web root path is the absolute path to the directory that contains the web-servable application content files.

Where is the Wwwroot folder?

Right-click the Web application you want more information about, such as SharePoint (80), and then click Properties. In the Default Web Site Properties window, click the Home Directory tab. The Local Path field in this tab shows the Web application root folder.


1 Answers

Server.MapPath("~"); 

or:

HostingEnvironment.ApplicationPhysicalPath  
like image 173
Darin Dimitrov Avatar answered Sep 23 '22 19:09

Darin Dimitrov