Can't get project directory path in MVC application

I am trying to get the path to the project directory ( My Documents\Visual Studio 2013\Projects\SmartPhoneCatalog\SmartPhoneCatalog

).

tried Directory.GetCurrentDirectory

and Enviroment.CurrentDirectory

but both returned the folder path IIS Express

. ( C:\Program Files (x86)\IIS Express\

)

Any suggestions what methods to use?

+3


source to share


3 answers


try it HostingEnvironment.ApplicationPhysicalPath



+5


source


Try it AppDomain.CurrentDomain.BaseDirectory

.



If memory is in use this will take you to My Documents\Visual Studio 2013\Projects\SmartPhoneCatalog\SmartPhoneCatalog\bin

, so you may have to move from one directory from here.

+4


source


You can do:

 HttpContext.Current.Request.PhysicalApplicationPath

      

0


source







All Articles