views:

39

answers:

2

I've added a PNG file to a directory in my VS2k8 webforms project, and when I run the app, it refuses to render my image - it even knows the dimensions but renders a box with a red X.

Oddly enough, if I double click the PNG file within VS2k8, it opens up in the IDE and displays fine (but only within the IDE).

Does anyone have any clues?

The path is correct.. I just have a basic default.aspx page with this in the body

  <img src="img/logo.png" />

if i navigate to img/logo.png in the browser, it shows a box with the same dimensions as my image, but a red x. Its finding the image, just not rendering it. It's showing up in IE running under the vs2k8 web server (localhost:5512/default.aspx)

I've dropped a JPG in the same directory, and it shows up just fine.

I'm not sure what type of PNG it is, but here is the kicker.... If i make an HTML file that references that image, copy both this HTML file and PNG file to my webserver (or just double click on the HTML page), it comes up JUST FINE.

Its leading me to believe that the Visual Studio web server may not recognize PNG files (at least this one) properly?

A: 

Try changing the path to:

 <img src="/img/logo.png" />
Jess
tried that. same thing. i even copied the image into every folder in my project.
NoCarrier
A: 

Try to use Firebug on the running page. It will let you change the path dynamically so that you can see if there is a problem with the path. Alternatively you can also just copy your dev path, say "http://localhost:&lt;someport&gt;/img/logo.png" and see whether it loads there.

As a third alternative you could use the <asp:Image id="imageLoge" runat="server" ImageUrl="..."/>. The advantage is that it will let you browse in the folders and select your image. In this way you're guaranteed that it is not a problem with your path.

Juri