Search code examples
asp.netimagemaster-pages

master page images not showing on child pages


This is probably something really simple but I cant see what! Any images I have in a masterpage aren't showing up in child pages, all I get is the box with the red cross in it.

I don't think Ive done anything different from usual and it's not something that's happened in other sites so im kinda scratchin my head with it. Any ideas are appreciated!


Solution

  • Kevin's got the essence of the problem right - your URL in your master page is likely relative to the location of the master page, and when it's included in the child page, the relative reference isn't correct anymore. The simplest solution for this sort of thing is to have your master page URLs be relative to the site, not the page. In other words, if you've been doing

    <img src="images/picture1.gif">
    

    You need to replace that with

    <img src="/images/picture1.gif">
    

    or something similar.