Hi All,
In my web application, I wanna check the given directory is exist in remote location,
if it exists then compress that directory into zip and download in browser. How can i achieve this.
Thanks in Advance
Know the answer? Post it. Somebody with the same question will find it here.
Ben Tomas2 pointsPosted Jan 29, 2016, 3:06 AM EST
You should create HTML and then create a zip file like:
using(ZipFile file = new ZipFile()) { file.AddEntry(''myHtml''+'''.html',''generatedHtml''); file.AddEntry(''myXml''+'''.xml',''generatedXml''); file.AddEntry(''myText''+'''.txt',''generatedTxt''); Response.ClearContent();Response.ClearHeaders(); Response.AppendHeader("content-disposition","attachment;filename=Report.zip"); file.Save(Response.OutputStream); }and then saving the zip file on output stream. It's working fine, ZipFile download option pops up in the browser and is downloaded wherever user saves it like: