I want to download images from the server. When the image doesn't exist, I want to show my default image.
Here's my code:
string url = "http://www......d_common_conference" + "/" + c.id_common_conference + "-MDC.jpg";
try {
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
request.Method = "HEAD";
HttpWebResponse response = request.GetResponse() as HttpWebResponse;
string status = Response.StatusCode.ToString();
img.ImageUrl = url;
}
catch (Exception excep) {
img.ImageUrl = "images/silhouete.jpg";
string msg = excep.Message;
}
It works nice, but until the 24th loop, no response, no exception thrown, and my program becomes jammed.
How can I fix this?