using System.IO.Compression;
string TOZipPath = String.Format("~/Static/ZIP/{0}", DirName); //需要压缩的源文件 string TOZipFilePath = String.Format("~/Static/ZIP/{0}", DirName + ".zip"); //压缩成新的Zip文件
try
{ ZipFile.CreateFromDirectory(Server.MapPath(TOZipPath), Server.MapPath(TOZipFilePath));}catch (Exception ex){}