There are different examples for async controllers. Some of them use CancellationToken in method definition:
public async Task ShowItem(i
You could use this
public async Task MyReallySlowReport(CancellationToken cancellationToken)
{
CancellationToken disconnectedToken = Response.ClientDisconnectedToken;
using (var source = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken, disconnectedToken))
{
IEnumerable items;
using (ApplicationDbContext context = new ApplicationDbContext())
{
items = await context.ReportItems.ToArrayAsync(source.Token);
}
return View(items);
}
}
taken from here.