I create a website and map it to the subdirectory D:\MyWebApp and Plugins . I create a virtual directory and map it to D:\Project\Presentation\Web\Accounting . the problem is when I want to get the physical path http://localhost/Plugins/Accounting , I get the wrong result.
both Server.MapPath("~/Plugins/Accounting") and Server.MapPath("/Plugins/Accounting") return 'D: \ MyWebApp \ Plugins \ Accounting' that do not physically exist. I want to get D:\Project\Presentation\Web\Accounting . I search for it and just get below lines:
- Server.MapPath (".") Returns the current physical directory of the executable file (for example, aspx)
- Server.MapPath ("..") returns the parent directory
- Server.MapPath ("~") returns the physical path to the application root
- Server.MapPath ("/") returns the physical path to the root of the domain name (not necessarily the same as the application root)
but in my case (virtual directory in a subfolder) it does not work !!! I use IIS8 and Asp.Net-Mvc 4 and C # 4. how can I get this?
source share