I am trying to unzip a downloaded file with Ionic.Zip Dll.
My code works in a windows application but it wont work in my Web application.
The code runs with no errors but when i check the folder there is still the Ziped downloaded file with no extractions.
Is there any specificity things a web application needs to do this??
private void MyExtract()
{
string zipToUnpack = "C:\\Users\\Shaun\\Desktop\\RescommTestData\\downloadfile.zip";
string unpackDirectory = "ExtractedFiles"; //used to create a file to extract files to
using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
{
// here, we extract every entry, but we could extract conditionally
// based on entry name, size, date, checkbox status, etc.
foreach (ZipEntry e in zip1)
{
e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
// e.Extract(ExtractExistingFileAction.OverwriteSilently);
}
}
try
{
//File.Delete("C:\\Users\\Shaun\\Desktop\\downloadfile.zip");
MessageBox.Show("Unpacked photos and data file into ExtractedFiles folder in bin/Debug");
}
catch (Exception)
{
MessageBox.Show("Could not delete ZIP!");
Environment.Exit(1);
}