这是我在MVC 2.0中尝试的东西
public class SomeController : AsyncController
{
public void SampleAsync()
{
AsyncManager.OutstandingOperations.Increment();
for(int i=0; i=100000; i++)
{
// Some Code... This loop is just for the testing.
}
AsyncManager.OutstandingOperations.Decrement();
}
public ActionResult SampleCompleted(ActionResult result)
{
return result;
}
}
答案 0 :(得分:0)
例如:
public void SampleAsync()
{
AsyncManager.OutstandingOperations.Increment();
for(int i=0; i=100000; i++)
{
}
AsyncManager.Parameters["myvariable"] = "variable value";
AsyncManager.OutstandingOperations.Decrement();
}
public ActionResult SampleCompleted(string myvariable)
{
//myvariable contains value "variable value"
return result;
}
2。您无需进行更改。