%@ Page Language="C#" Debug="true" %> <%@ Import Namespace="System.Text" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="Ionic.Zip" %> <%@ Import Namespace="System.Collections.Generic" %>
This page uses the .NET Zip library (see http://DotNetZip.codeplex.com) to dynamically create a zip archive, and then download it to the browser through Response.OutputStream, via a FileStream. This page is implemented in C#.
In some cases, saving a zip directly to Response.OutputStream can present problems for the unzipper, especially on Macintosh. To workaround that, you can save to a file, then copy the contents of the file, via a FileStream, to the Response.OutputStream.