Server side zipping

Feb 6, 2013 at 2:32 PM
I am using DotNet Zip to zip up a dataset that is written to an XML file all froma web page.

When I use Server.MapPath to find the file to zip the entire server local path is stored in the zip file.

I have tried a few variations on this and have not been able to locate just the virtual path and not include the path in the zip file.

Is there a sample somewhere that shows the correct method to accomplish this?

Feb 17, 2013 at 7:49 AM

How do you want the files to appear in the .zip File?
If you want all files to appear in the .zip file without directories, it can be easily done by passing String.Empty as the second parameter to the ZipFile.AddFile method.
This will place the file in the root of the .zip file.

Hope this helps