Last post Jul 04, 2012 11:44 AM by sanjay.s.b.25
Apr 09, 2009 08:45 PM|bladerunner148|LINK
I have an app that zips a file and send that as an attachment in an email. Everything works, I am using this Ionic.Zip.dll to create a zipped file. Currently I am saving the files in a folder called output and this folder is also in the server
where the application is hosted. The problem is when a user opens the zipped file to see the file inside, they have to go through all the directories to see the file. This is not good in terms of security since a user can know the path to our webservice. Is
it possible to display the file from the zipped folder instead of taking them through each directories? I don't know what i am doing wrong here.
string sourceFile = Server.MapPath("~/output/" + test.csv);
string zippedFile = Server.MapPath("~/output/" + test.zip");
//call the Ionic.Zip method to create a zipped file
private void CreateZipFile(string finalfile, string sourcefile)
using (ZipFile zip = new ZipFile())
catch (Exception ex)
throw new Exception ( "Error occured: " + ex);
After the user opens the zipped file, they have to go through the entire directories before they see the final file which in this case is test.csv. Any help?
Apr 10, 2009 08:16 PM|whighfield|LINK
Try using the the AddDirectory method
zip.AddDirectory("c:\program files\my app\your app\file.txt", "Files");
This should store the file.txt in the archive as Files\file.txt
Apr 15, 2009 11:24 PM|bladerunner148|LINK
Sorry whighfield, I hadn't been on the forum since the day I made this post. I got that fixed the same day...zip.AddFile(sourceFile, "");
This removed the directory and now the user can just see the file.
Thanks for your input.
Apr 08, 2010 07:17 AM|six.samy|LINK
Fantastic work around!!! Thanks for saving my time :)
Jul 04, 2012 11:44 AM|sanjay.s.b.25|LINK
@bladerunner148 Worked fine.. Good Idea..