How to check the image availability on server

  • Thread starter Thread starter Anil
  • Start date Start date
A

Anil

Hi All,

we have hundreds of images on our server. They are shown on the webpage with
the unique id.
So, if the image is available then we want to show the image. If not
available then, we want to display a default image.

Please let me know how to do it. And if someone has got code, please send
it.

Thanks,
Anil
 
Anil,

I would route the image request through an ASPX page. Basically, add
the filename to the querystring. Then, in the page, check to see if the
file exists. If it does, then redirect to the image. Otherwise, redirect
to the default image.

Hope this helps.
 
Presumably you are storing the path to the file somewhere. If you want to
just check for the existence of a file, then you can use the File.Exists
method.
 
Back
Top