Код: Выделить всё
public async Task ExportAsync(CancellationToken cancellationToken = default)
{
Response.Headers.Append("X-Content-Type-Options", "nosniff");
Response.Headers.Append("Cache-Control", "no-cache, no-store, must-revalidate");
Response.Headers.Append("Pragma", "no-cache");
Response.Headers.Append("Expires", "0");
Response.ContentType = "application/zip";
Response.Headers.Append("Content-Disposition", "attachment; filename=\"file.zip\"");
PipeWriter outStream = HttpContext.Response.BodyWriter;
byte[] buffer = new byte[100];
ReadOnlyMemory source = new ReadOnlyMemory(buffer);
for (int i = 0; i < 100; i++)
{
await outStream.WriteAsync(source, cancellationToken);
await outStream.FlushAsync(cancellationToken);
await Task.Delay(100, cancellationToken);
}
return new EmptyResult();
}
Почему вообще нет анимации загрузки?
Подробнее здесь: https://stackoverflow.com/questions/791 ... re-to-chro
Мобильная версия