Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get ASP.NET application path? [duplicate]

Tags:

I have my owned siteMapProvider, I need phisical file path to initialize it but I can't use HttpContext to do that, because IIS 7 will thrown exception:

fileName = HttpContext.Current.Server.MapPath(fileName); 

How can I do MapPath without HttpContext?

like image 670
Viacheslav Smityukh Avatar asked Mar 08 '11 14:03

Viacheslav Smityukh


People also ask

What is application StartupPath?

StartupPath property returns the path for the executable file that started the application, not the path where the application executable is stored. ExecutablePath property returns the path for the executable file that started the application, including the executable name.


1 Answers

Take a look at the following: HttpRuntime.AppDomainAppPath (from MSDN)

like image 127
NakedBrunch Avatar answered Oct 04 '22 04:10

NakedBrunch