I don't know if it possible but I would like to display an alert box when an async method is finish even if we change view on the website.
For exemple : I'm on page "A" and I run an async method on my controller "A" with this code :
public async Task<ActionResult> functionA()
{
Task task = new Task(() =>
{
LotofAction();
System.Threading.Thread.Sleep(5000);
}
);
task.Start();
await task;
return RedirectToAction("Index", "Home");
}
If I change page to Page "B" before end of task, my controller will not redirect to Home/index (in debug I can go to the line but no redirect)
If I do not change page I will redirect to the correct page
So I have two questions : How to to execute an alert box (in javascript) instead of redirect to action ? How my controller can display this alert even if we change of page ? (I do not find any "master" controller on MVC)