Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8924499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:26:10+00:00 2026-06-15T07:26:10+00:00

I am using Ionic.Zip (Compact Framework version) in my Pocket-PC project. Extracting zipped files

  • 0

I am using Ionic.Zip (Compact Framework version) in my Pocket-PC project.
Extracting zipped files (using Ionic.Zip) are working properly. If I put password on the compressed file, it requires the password before extracting, but when I try this instance, password validation for extraction fails.

Example: This folder is about to compress.

\MyDevice\My Documents\My Pictures  

This folder contains two files ('Flower.jpg','Waterfall.jpg')
Compressing the file using this code:

public string Compress(string[] Paths, string SaveFileName, string Password, string CompressionType)
{
    try
    {
        using (ZipFile zip = new ZipFile())
        {
            if (string.IsNullOrEmpty(Password))
                zip.Password = Password;
            zip.CompressionLevel = Utility.GetCompressionLevel(CompressionType);
            foreach (string item in Paths)
            {
                if (Utility.IsDirectory(item))
                    zip.AddDirectory(item);
                else if (Utility.IsFile(item))
                    zip.AddFile(item);
            }
            if (!SaveFileName.Trim().ToLower().EndsWith(".zip"))
                if (SaveFileName.Trim().EndsWith("."))
                    SaveFileName += "zip";
                else
                    SaveFileName += ".zip";

            zip.Save(SaveFileName);
        }
        return Utility.GetResourceString("ZipSuccess");
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
}

Extraction code:

public string Decompress(string ZipFilePath, string TargetPath, string Password, bool OverwriteExistingFiles)
{
    try
    {
        using (ZipFile decompress = ZipFile.Read(ZipFilePath))
        {
            if (!string.IsNullOrEmpty(Password))
                decompress.Password = Password;

            foreach (ZipEntry e in decompress)
            {
                e.Extract(TargetPath, OverwriteExistingFiles ? ExtractExistingFileAction.OverwriteSilently : ExtractExistingFileAction.DoNotOverwrite);
            }
        }
        return Utility.GetResourceString("ExtractSuccess");
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
}  

Extracting the file in this location works great, because it requires password:

\MyDevice\My Documents\Personal  

But! When I extract the file on the same folder:

\MyDevice\My Documents\My Pictures  

It extract the files without requiring the password.
I think this is a bug. What can I do for this?
Hope someone could answer. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T07:26:12+00:00Added an answer on June 15, 2026 at 7:26 am

    There is a bug in your Compress() method. When compressing your files, the Password property of the ZipFile instance is never set. Take a look at your logic that decides whether or not to assign the zip.Password property.

    It reads:

    if (string.IsNullOrEmpty(Password))
        zip.Password = Password;
    

    As written, the zip.Password property will be set only if the Password parameter is null or an empty string. If the Password parameter is a non-blank string, the code skips zip.Password assignment statement.

    The if-statement in your Compress() method is missing a not operator. It should read:

    if ( ! string.IsNullOrEmpty(Password))
        zip.Password = Password
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a zip file compressed using Ionic zip . Before extracting I need
I am using the latest version of ionic zip version 1.9.1.8.I have set the
Using ASIHTTPRequest, I downloaded a zip file containing a folder with several audio files.
I'm trying to zip up log using DotNetZip and powershell. The files are in
using System; using System.ComponentModel; using System.Net; using System.Windows.Forms; using Ionic.Zip; namespace downloader { public
I'm using iconic.dll file to read data from compressed files (.zip file extensions) Please
At the moment I am using to store the zip files with the file
I m currently using Ionic zip librar y. I was curious if there s
I'm trying to make a method of compressing file using Ionic.Zip.dll of DotNetZip. Code
I am using IonicZip to compress video files and store in a blob field.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.