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

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!
 
J

Jesse Houwing

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...
 
M

Mike

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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top