Rewriting Question
I cannot, for the life of me, get relative image paths work consistently inside usercontrols between using VS's dev server and publishing to a remote IIS server. I do not want to make my image a server tag by adding runat="server"
. I want it to be strictly client and I do not want to use any hocus pocus code hacks. I want to resolve the disconnect, so here is my problem:
My images are stored in ~/images
.
My usercontrols are stored in ~/usercontrols/anothersubfolder
.
When I do this...
<img id="myimage" src="../../Images/help.png" alt="" />
...the image loads when using the VS dev server (localhost), but not when I deploy to a remote IIS virtual directory. However, when I do this...
<img id="myimage" src="<%=Request.ApplicationPath %>/Images/help.png" alt="" />
...it works when I publish remotely, but not using the dev server!
I need a solution that works for both the VS dev server AND when I publish remotely. As I said, I do not want to add runat="server"
to my image tag or use any code hacks. There is a disconnect here and I want to know how to go about resolving that.