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){}