Using the examples for exporting excel and other documents, the site becomes unresponsive, requiring a reload. Here is the code:
Services Class:
2. This is called from the Blazor.cs:
public async Task ExportErrorFile(Query query = null)
{
_navigationManager.NavigateTo(query != null ? query.ToUrl("/export/bulkload/error"): "/export/bulkload/error", true);
}
ExportFilesController:
2. This calls the ExportController
[HttpGet("/export/bulkload/error")]
public FileStreamResult ExportErrorFile()
{
return ToExportErrorFile(ApplyErrorQuery(Request.Query));
}
ExportController:
3. This is the code that formats the excel, and returns the FileStreamResult:
public FileStreamResult ToExportErrorFile(IList errors)
{
var bytes = new ExcelWriter().GenerateFile(errors.ToList());
if (bytes == null) return null;
var time = $"{DateTime.Now.Hour}{DateTime.Now.Minute}{DateTime.Now.Second}";
var stream = new MemoryStream(bytes);
var result = new FileStreamResult(stream, @"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
FileDownloadName = $"ERROR_FILE_{DateTime.Now.ToShortDateString().ToYearMonthDay()}-{time}.xlsx"
};
return result;
}
Now, everything works as designed (download works, files open, etc.) EXCEPT, when it returns the result, the site requires a reload. Any suggestions or tips to resolve this issue?