0

I am trying to download different images from the web using HTTPWebRequest i am just wondering that i am using a loop to send many requests on the web to download images some of the come back earlier then others. So the problem is in the callback function how can i know that which image is the response of which request?

In other words is there a way to set some tag with the request so that when i get the response back i know that for which request i got the response.

Any help will be appreciated...

Madu
  • 4,849
  • 9
  • 44
  • 78
  • Are you using an async method for downloading the images? If you have the webrequest instance you should be able to use the `RequestUri` property? Would you mind showing some code where you want to know of the specific request? – Patrick Jun 06 '13 at 14:14

1 Answers1

0

if u are sending requests in a loop, than u must process the response of each request in that loop too

    For(int i = 0; i < 10; i++) {
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("some uri"));

        // some code

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        // some code
        response.Close();
    }
Ashok Damani
  • 3,896
  • 4
  • 30
  • 48
  • I think in the case of the loop if loop is running n times then the callback function is also called n time automatically. so do really need a loop or i think that the callback will be called automatically n times. – Madu Jun 06 '13 at 13:38