ASP.NET核2.0動畫顯示頁面異步方法,然後重定向
public IActionResult Processing()
{
DoWork();
return View(); // returning Processing.cshtml
// which contains page with animation
}
private async void DoWork()
{
await DoSomething();
// and here I want to redirect
// from page with animation to
// to an action
}
如何重定向到從異步方法的行動?動畫頁面必須始終顯示,而await DoSomething()
適用於數據。
你需要小心你的方法。不等待'Task'並執行'async void'只是要求問題。我建議你閱讀一些有關異步編程的內容。 –