We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

[4654] Asynchronous HttpWebRequest

Last post 05-22-2007 8:17 PM by gabegarza. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [4654] Asynchronous HttpWebRequest

    This thread is for discussions of Asynchronous HttpWebRequest.

    • Post Points: 15
  • 03-30-2006 6:45 PM In reply to

    Re: [4654] Asynchronous HttpWebRequest

    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


















    • Post Points: 5
  • 05-22-2007 8:17 PM In reply to

    • gabegarza
    • Not Ranked
    • Joined on 05-22-2007
    • United States
    • New Member
    • Points 5

    Re: [4654] Asynchronous HttpWebRequest

    "Careful with that Axe Eugene" - I love that song.

     

    • Post Points: 5
Page 1 of 1 (3 items)