步驟
using System
using System
using ICSharpCode
using ICSharpCode
using ICSharpCode
#region 下列代碼為壓縮並下載代碼
ZipOutputStream zos = null;
String strBaseDir = "";
void dlZipDir(string strPath
{
MemoryStream ms = null;
Response
strFileName = HttpUtility
Response
ms = new MemoryStream();
zos = new ZipOutputStream(ms);
strBaseDir = strPath + "";
addZipEntry(strBaseDir);
zos
zos
Response
Response
Response
}
void addZipEntry(string PathStr)
{
DirectoryInfo di = new DirectoryInfo(PathStr);
foreach (DirectoryInfo item in di
{
addZipEntry(item
}
foreach (FileInfo item in di
{
FileStream fs = File
byte[] buffer = new byte[fs
fs
string strEntryName = item
ZipEntry entry = new ZipEntry(strEntryName);
zos
zos
fs
}
}
PRotected void Button
{
string userPath ="D:華海實訓(qqview
dlZipDir(userPath
}
#endregion
From:http://tw.wingwit.com/Article/program/net/201311/14232.html