Handling multiple async HTTP requests in Silverlight serially
Posted
by
Jeb
on Stack Overflow
See other posts from Stack Overflow
or by Jeb
Published on 2011-02-04T22:22:21Z
Indexed on
2011/02/08
15:25 UTC
Read the original article
Hit count: 222
Due to the async nature of http access via WebClient or HttpWebRequest in Silverlight 4, when I want to do multiple http get/posts serially, I find myself writing code that looks like this:
doFirstGet(someParams, () =>
{
doSecondGet(someParams, () =>
{
doThirdGet(...
}
});
Or something similar. I'll end up nesting subsequent calls within callbacks usually implemented using lambdas of some sort. Even if I break things out into Actions or separate methods, it still ends up being hard to read.
Does anyone have a clean solution to executing multiple http requests in SL 4 serially?
I don't need things to be synchronous, I just want serial execution.
© Stack Overflow or respective owner