In IIS, I have my website set up like so:
- MyWebsite
- Images
- MyVirtualDirectory
- Management
I am wanting to access image files in MyWebsite/Images
from a page in MyVirtualDirectory/Management
.
For example, in MyVirtualDirectory/Management/MyPage.aspx
, I am trying to access an image like so:
Server.MapPath("~/Images/myimage.jpg")
But after running, the path is not correct. In google chrome I can view the HTML, and it appears as <img src="../../Images/myimage.jpg" />
. If I remove the ../..
then it is fine, but I am wondering why the ~/...
syntax isn't working.