Hi Steven
I've got the following problem and your proposal seems to be the solution:
I want to do a asynchronous Request, where I have to post a large amount of data to some old asp - component. "Asynchronous" means for me to start the posting and imideately continue with my workflow while in background the huge amount of data is posting...
therrefore I call as suggested in msdn - help:
// Start the asynchronous request.
IAsyncResult result = ( IAsyncResult ) httpRequest.BeginGetResponse ( new AsyncCallback ( RespCallback ), state );
// this line implements the timeout, if there is a timeout, the callback fires and the request becomes aborted
ThreadPool.RegisterWaitForSingleObject (
result.AsyncWaitHandle, new WaitOrTimerCallback ( TimeoutCallback ),
httpRequest, DefaultTimeout, true );
Now I set my breakpoint in the RespCallback() - Method and here'se the problem:
after BeginGetResponse () the process first jumps to RespCallback() and then jumps to RegisterWaitForSingleObject()
So this is not realy asynchronous...
Did I miss something or is this general behaviour ?
after trying your solution (perform this request in an extra thread) I saw that this would be the right way but I have some questions left:
If you start this request in an extra thread, why do you make this request asynchronous ?
I think, asynchronity in this place is achieved by the extra thread which runs in the background
Is there a way to achieve the asynchronity I want without this extra thread (I'm not sure that what I want realy matches the meaning of "asynchronity" used by BeginGetResponse() ... EndGetResponse() ) ?
thanx in advance and nice greetings
Bernd
Enter your message below
Sign in or Join us (it's free).