ASP.NET - Download of image from url - Asked By anbu n on 02-Jun-11 02:15 AM

I've to download the images from particular URL using , for loop in case some products having more than 5 images .. when i click the product button some of the images only getting download not all images..but when i debug the corresponding code works fine, i.e,  its downloads all the images..properly .
is this due to some cache .... or image file is in Gif format....

This is My Code

for (int i = 0; i < obj.Count; i++)
PartNAme = (obj[i].ToString().Split('='))[1];
_prtnm = PartNAme.ToString().Split(';')[0];

//this is url ,  source for the image
_final_URI = _URI + _Prod_name + '/' + _prtnm + ".GIF";

WebClient client = new WebClient();

string strtempname = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "");

rnd = new Random(100);

string _strfile = "PNImage" + strtempname + rnd.Next().ToString() + ".gif";

string _path = "../Images/PNImage/" + _strfile;

string _PPath = Server.MapPath(_path);

//to download image from source url, and path to save the image file
client.DownloadFile(_final_URI, _PPath);

in above code when i debug the image files are getting downloaded properly, but while running without debug some image files gets repeated so instead of getting original image file , old/same image file gets downloaded instead...
is this due to some cache .... or image file is in Gif format....
Kirtan Patel replied to anbu n on 02-Jun-11 02:17 AM
can you provide the website from which you are downloading images ?