A
A
Alexey2016-11-11 13:30:04
.NET
Alexey, 2016-11-11 13:30:04

.Net how to send a long generated file to a web browser?

The report is generated on the server. Depending on the amount of data, 20-30 minutes can be generated. How can I generate it, save it, and give a link to this file? At the same time, it is not saved in the server file system.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-11-11
@senal

Start writing to Response.OutputStream at least something.
For example, with this approach, the client starts receiving the file immediately without waiting for the end of the archive formation.

Response.ContentType = "application/zip";
Response.AppendHeader("Content-Disposition", "attachment; filename=qqq.zip");
zipFile.Save(Response.OutputStream);

Response.End();

It should be borne in mind that the worker thread will be busy and at the same time you will not give many files in this way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question