Reputation: 19707
Using a Generic Handler, I'd like to 2 do things in parallel. First, I need to send a request to a 3rd part and get the result back (this can take up to 25 seconds) and while that is happening, parse some XML and insert a record into a database.
How would I go about issuing an Http request (like GetResponse()) but not have it pause until it gets a response?
Upvotes: 0
Views: 65
Reputation: 1
Another option is creating a web service class in your project and having the web service do the work for the 3rd party request. Methods in a web service can be called asynchronously, so you can create a method in the service, reference the service from your page, then use the asynchronous overload of the method.
Upvotes: 0
Reputation: 8152
Create an asynchronous HTTP handler class. In your BeginProcessRequest
, you can create two tasks, one for the 3rd party request, one for the XML parse and then run them in parallel. Here's a pretty good tutorial that shows how to define tasks that return values and run them in parallel.
Upvotes: 1