I have a razor page that shows a 'Please wait' box and the OnGet
method does some stuff that might take a few seconds and ends with a LocalRedirect
.
The razor code:
@page
@inject IStringLocalizer<Startup> localizer
<div >
<div >
<div >
<div >
<div >
<div role="status" />
</div>
<p >@localizer["PleaseWait"]</p>
</div>
</div>
</div>
</div>
And the code-behind:
public async Task<IActionResult> OnGet()
{
//Do some stuff that takes a few seconds...
return LocalRedirect("/Dashboard");
}
Everything is working apart from the page first being shown and then executing the code.
Is it possible to first render the page (so that the users can see that something is happening) and then execute the code in the OnGet
?
CodePudding user response: