我正在使用asp.net 2.0并为异步操作编写此代码。我有一个动态的迭代次数,所以我实现了一个FOR循环来注册要完成的动态数量的任务异步
我的问题是这段代码只注册最后一次迭代而忽略前9次
请咨询
int itterations = 10;
for (int i = 0; i < itterations; i++)
{
ViewState.Add("name",i.ToString());
WSProxy3.WebService3 obj3=new WSProxy3.WebService3();
BeginEventHandler beginHandler3 = new BeginEventHandler(BeginAsyncOperation3);
EndEventHandler endHandler3 = new EndEventHandler(EndAsyncOperation3);
EndEventHandler timeoutHandler3 = new EndEventHandler(TimeoutAsyncOperation3);
object state3 = obj3;
PageAsyncTask task3 = new PageAsyncTask(beginHandler3, endHandler3, timeoutHandler3, state3,true);
Page.RegisterAsyncTask(task3);
}