You can zip a file or a folder in ASP.NET by using java.util.zip.ZipFile, ICSharpCode.SharpZipLib.Zip or other library assemblies.
SharpZipLib can be downloaded from: https://www.icsharpcode.net/OpenSource/SharpZipLib/Download.aspx.
The ASP.NET examples below demonstrate how to zip files.
using ICSharpCode.SharpZipLib.Zip;
using System.IO;
ZipOutputStream zos = null;
protected void Button1_Click(object sender, EventArgs e)
{
string[] pathCollection = new string[2];
PathCellction[0] = “c:\\folder1”;
…