Check if ImageURL (which is an internet url) exists?

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi. Is there a way programmatically to check if an image control's ImageURL
property (which is an image on the internet) actually exists? I have a 3rd
party company that hosts all the images displayed on my site, and I want to
display a default image if the ImageURL for a specific image doesn't exist.

Thanks!
 
Hello Mike,
Hi. Is there a way programmatically to check if an image control's
ImageURL property (which is an image on the internet) actually exists?
I have a 3rd party company that hosts all the images displayed on my
site, and I want to display a default image if the ImageURL for a
specific image doesn't exist.

You could do a webrequest (would probably be best to just check the headers)
from the server. If it comes back other than 200, it doesn't exist.

You might want to cache the result though... it won't be pretty otherwise...
 
Thanks I'll give it a try!

Jesse Houwing said:
Hello Mike,


You could do a webrequest (would probably be best to just check the headers)
from the server. If it comes back other than 200, it doesn't exist.

You might want to cache the result though... it won't be pretty otherwise...
 
Back
Top