Images of the main page that are not displayed on child pages

This is probably something really simple, but I can’t understand that! Any images that I have on the main page are not displayed on child pages, all I get is a box with a red cross in it.

I don’t think that I did something different from the usual, and this is not what happened on other sites, so I blushed a little in my head. Any ideas are welcome!

+6
image master-pages
source share
9 answers

Kevin correctly understood the essence of the problem: your URL on your main page most likely refers to the location of the main page, and when it is included in the child page, the relative link no longer works. The simplest solution for this kind of thing is to have your main page URLs relative to the site, not the page. In other words, if you did

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

You need to replace this with

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

or something similar.

+19
source share

on the main page, you use an src image similar to the line below, and this will work. the same problem is solved in this way.

 src="<%= Page.ResolveUrl("~")%>Images/myimage.png" 
+8
source share

Did you specify the runat = "server" image and use the root relative path ~ ~ to the file?

+4
source share

Your image url is invalid.

+1
source share

Try using absolute paths to your images.

I had this problem when using a master file with content pages in different subdirectories. If you use relative paths to your images, this should be relative to the content page, not the wizard.

Edit: This is true if you use the img tag to display your images. asp:Image behaves better =)

+1
source share

It definitely sounds like you have a problem with paths. Look at the source on your page and see where it is trying to upload the image, which should help you fix your path.

0
source share

If you set the correct path, then you will get the same problem as you can try, this will solve your problem:

Use double dots (..) before starting the URL.

0
source share

If content pages are inside subfolders, this problem occurs. When the content page is displayed, markup is created again for the contents of the main page, and the location of the image may be displayed differently, as shown on the main page. It is best to replace the asp: Image element instead of the HTML image tag. Then determine the absolute value, starting from: ~ / to the actual location of the image. This should solve the problem. Remove the entire image tag before inserting asp:Image , since the attributes are different for both. Good luck !!.

0
source share

If the image<img> tag is used instead, use " style="background-image: url('/Images/welc.jpg'); "in any other tag. It looks silly. But it works for me. I also get this problem, after using it after that I got an image on all of my child pages.

0
source share

All Articles