How do I generate and send a .zip file to a user in C# ASP.NET?

后端 未结 7 1046
感动是毒
感动是毒 2020-12-05 11:30

I need to construct and send a zip to a user.

I\'ve seen examples doing one or the other, but not both, and am curious if there are any \'best practices\' or anythin

相关标签:
7条回答
  • 2020-12-05 12:32

    One concern is the size of the file that you will be streaming to the client. If you use SharpZipLib to build the ZIP in-memory, you don't have any temp files to cleanup, but you'll soon run into memory issues if the files are large and a number of concurrent users are downloading files. (We experienced this pretty frequently when ZIP sizes got to the 200 MB+ range.) I worked around this by the temp file to disk, streaming it to the user, and deleting it when then request completed.

    0 讨论(0)
提交回复
热议问题