httpcontext current server mappath shows c:\inetpub\wwwroot when the current location is somewhere else

StackOverflow https://stackoverflow.com/questions/17843366

문제

I have taken on a MVC project, in VS 2008, from another developer and I need to know why HttpContext.Current.Server.MapPath("/") is c:\inetpub\wwwroot.

I am running the project from c:\Websites\Customer\Web\Website\Application\

IIS shows that the site is running from: c:\Websites\Customer\Web\Website\Application\ so I am ultra confused.

Any thoughts?

올바른 솔루션이 없습니다

다른 팁

Use Server.MapPath("~"), which returns the physical path of the root of your application.

The Server.MapPath("/") you are using, returns the physical path of the root of the domain.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top