mson
mson

Reputation: 7824

png file not displaying

i have a few png files in my asp.net 3.5 web app. the images displaying correctly in dev; however, when i load the app on the server, the png files do not display. i'm using w2k8 and iis. when i server another image file from same directory (jpg), it works. is there something i am missing with png files?

Upvotes: 4

Views: 16651

Answers (3)

Steve Smith
Steve Smith

Reputation: 2270

This can be caused by IIS not having the Mime Types/Static Content option installed. This can be installed as follows (taken from https://stackoverflow.com/a/42191613/1551685):-

...if you're on a non-server OS like Windows 8, do a search on the start page for "Turn Windows features on or off" and enable Internet Information Services -> World Wide Web Services -> Common HTTP Features -> Static Content"

(Why this isn't installed by default is anyone's guess).

Upvotes: 0

Rob
Rob

Reputation: 3574

Very late but maybe not a wrong solution: If you rename a .jpg to .png it won't show in Microsoft's browsers. If you save the file again in Paint for example, it will change the mime-type or file-headers thus it will load after that change.

You can test this pretty easily:

  • Rename a .jpg file to .png
  • Load the page : The image is broken
  • Save the file as .png now
  • Load the page : The image will load now

Upvotes: 0

Bernhard Hofmann
Bernhard Hofmann

Reputation: 10411

This sounds like a permissions problem. Have you checked the permissions on one of the PNG files to be certain that they can be read by EVERYONE?

If you can access the server directly, can you see the images if you use a browser on the server and visit the local site? http://localhost/

Can you try view the PNG directly by URL from your browser? By that I mean entering the full URL to the PNG itself rather than the page that is showing the PNG. For example http://sstatic.net/so/img/logo.png

Upvotes: 2

Related Questions