
img src="../images/check.gif"
Unfortunately, this would only work for pages that were in a relative directory location similar to where the image as the Master Page was, like page1.aspx. Any other page, like default.aspx, would not correctly resolve the relative path. One solution to this is to use the root path reference syntax in ASP.NET and ensure that all relative references are made from server-side controls, which is the only place this syntax works. The image reference I mentioned earlier would become:
img src="~/images/check.gif" runat="server"
Another option is to rely on the fact that relative path references in server-side controls are evaluated relative to the Master Page in which they are placed. This means that it would also be sufficient to change the image reference to the following:
img src="../images/check.gif" runat="server"
Aucun commentaire:
Enregistrer un commentaire