![]() In this blog post, you'll learn how to do just that from an ASP.NET MVC Action. Using ZipArchive you can create a ZIP file on the fly and send it to the client from ASP.NET without having to save the ZIP file to disk. The latter is more complicated to use but provides more flexibility because you can accept any stream to read from or write to whether the data comes from disk, from an HTTP request, or from a complicated data pipeline. On the other hand, the ZipArchive class uses streams to read and write ZIP files. ZipFile is a great API for simple use-cases where the source and target are both on disk. The ZipFile class has static methods to create and extract ZIP files without dealing with streams and byte-arrays. NET has multiple built-in APIs to create ZIP files. If you're trying to generate ZIPs and send them to the browser using ASP.NET Core, check out " Create ZIP files on HTTP request without intermediate files using ASP.NET MVC, Razor Pages, and endpoints". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |