Let’s say I have 50 requests that I started using BeginGetResponse.
How do I check the status of each request?
and how do I cancel it (sometimes they hang)?
and how can I perform an action when ALL requests are either completed or canceled?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The call to
BeginGetResponsereturns anIAsyncResult. Keep a reference to it. You can use theIAsyncResult.AsyncStateto check the status of the request.To cancel the request, call
WebRequest.Abortof the original WebRequest instance.To perform something when all requests are completed or cancelled, get a WaitHandle from
IAsyncResult.AsyncWaitHandlefor each of your requests, then wait on them all. Sample code here.