I am making a C# store app which contains pictures. I get the pictures from a website for example: http://www.gravatar.com/avatar/6810d91caff032b202c50701dd3af745?d=identicon&r=PG
I have 2 images, 1 is an image of the actual product. and 1 image is an image that there is no image available. Now i want to check if there is a picture behind the given URL, and if there is not, i want to load the image that there is no image available.
i got an object product which contains itemnumber, description and an imagepath. At this point i simply do this.
var url = "http://www.gravatar.com/avatar/6810d91caff032b202c50701dd3af745?d=identicon&r=PG";
Product p = new product (123, "productdescription", url);
if (url //if no results given){ p.url = imgpath2} // filepath with no image available picture
How can I make a simple check if the given url contains a picture, or will give me a "webpage not available"/ no content available error? thanks in advance.
edit: Note* i'm working with visual studio 2013, and I am building a C# store app.