步骤
1)先引用 ICSharpCode.SharpZipLib.dll;
2).cs文件引入
using System.IO;
using System.Text;
using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.GZip;
3)代码
#region 下列代码为压缩并下载代码
ZipOutputStream zos = null;
String strBaseDir = "";
void dlZipDir(string strPath, string strFileName)
{
MemoryStream ms = null;
Response.ContentType = "application/octet-stream";
strFileName = HttpUtility.UrlEncode(strFileName).Replace('+', ' ');