raimone

raimone

  • NA
  • 2
  • 29.1k

Async web request asp.net

Feb 1 2011 9:59 PM

I have the following scenario and would like to get some clarification if possible.

I have a javascript function that makes an ajax call to a handler(.ashx) file. The javascript function does not need a return value. The handler will post some data and be done. The handler file makes an ASYNC web request to Bitly, Facebook, and Twitter (not in that order). My idea solution would be for the handler to make an ASYNC call to Bitly (bit.ly), get the result then post to Twitter and Facebook at the same time on different threads as they are independent of each other.

What I am questioning about is the WaitHandle. Should I be using this since the handler is running outside of the user actions or will the callback methods be sufficient? Will the handler file still be listening for the callback if there is no call to hold the current thread until it returns? If I do need to make the thread wait for the callback am I still getting the benefit of making ASYNC web request seeing that the original thread is still waiting or hung up?

I kind of understand how this is suppose to work but can't quite put it all together.

NOTE: The handle is not used to intercept a web request. I am using the handler to process an ajax post. I am calling the handler directly.


Answers (1)