How to Compress Files in ASP.NET?

I don’t know How to Compress Files in ASP.NET. While net suffering I found one “”. Here I get some knowledge. Can anyone any other idea.
Asked Dec 08, 2014
'GZip object that compress the file
Dim myStreamZip As New GZipStream(myCompressedFile, CompressionMode.Compress)

'Write Back
myStreamZip.Write(myBuffer, 0, myBuffer.Length)
Me.lblResult.Text = """" + strName lblResult.Text = lblResult.Text + " was compressed &uploaded successfully."

What we do here is read the file into a stream, change its extension to the appropriate GZ ext, and compress using the GZipStream compression method.

Answered Nov 16, 2017
protected void btn_zip_Click(object sender, EventArgs e)
string path = Server.MapPath("~/Test/");//Location for inside Test Folder.
string[] Filenames = Directory.GetFiles(path);
using (ZipFile zip = new ZipFile())
Answered Apr 24, 2020

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.