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?
try it HostingEnvironment.ApplicationPhysicalPath
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.
You can do:
HttpContext.Current.Request.PhysicalApplicationPath