check if image or file exists

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi everyone,

I want to check if a certain file or image exists.
The picture exists when I use th eurl in my IE, but in my C# code, the if
statement returns false.
Is there another way to do this?

string PictureUrl =
"http://www.lessius-ho.be/webapp/personeelsindex/images/543.jpg";;
if (File.Exists(PictureUrl))
{
imgFotoPersoon.ImageUrl = PictureUrl;
imgFotoPersoon.Visible = true;
}
else
{
imgFotoPersoon.Visible = false;
}

thanks in advance,

Filip De Backer
.



Relevant Pages