Problems extracting file

Apr 12, 2010 at 10:50 AM


I am having problems extracting zip files. When I extract a small zipfile (1,74 MB) it works fine, but when I try to extract a larger zip file (395 MB),

I got this error message: ZipEntry::ReadHeader(): Bad signature (0x21726152) at position  0x00000000

The code:

public void unZip(string fromPath, string toPath)
                using (ZipFile zip = ZipFile.Read(fromPath))
                    foreach (ZipEntry entry in zip)
                        entry.Extract(toPath, ExtractExistingFileAction.OverwriteSilently);
            catch(Exception ex)

I am using DotnetZip 1.9.

What am I doing wrong?

Apr 12, 2010 at 2:39 PM

I don't know.  How did you create the zip file that you are trying to extract?

DotNetZip seems to think the zip file in question is not actually a zip file.

you can try unzip -t or unzip -i  to investigate the inner structure of the zip file you're trying to extract.


Apr 13, 2010 at 5:46 AM

To my big surprise the file I was trying to unzip was not a .zip file, it war a .rar file...

Thanks for the quick response!!


Nov 15, 2010 at 2:11 PM
Edited Nov 15, 2010 at 2:32 PM

Cheeso, I have the same error as MissyJ because I'm using Ionic.Zip.dll (v 1.9) to extract .rar file. I have read the documentation and it did mention that the dll support WinRAR and WinZip program. But seems the dll not working for .rar file. Any idea on below errormessage:

'Ionic.Zip.BadReadException' occurred in Ionic.Zip.dll

ZipEntry::ReadHeader(): Bad signature (0x21726152) at position  0x00000000


Below is my VB.Net SourceCode:

Dim ZipToUnpack As String = "d:\log\log.rar"
Dim UnpackDirectory As String = "d:\log\ExtractedFiles"
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
   Dim e As ZipEntry
   For Each e In zip1
      e.Extract(UnpackDirectory, ExtractExistingFileAction.OverwriteSilently)
End Using

Nov 15, 2010 at 2:55 PM

DotNetZip does not read or write RAR files.  WinRAR can produce ZIP files that DotNetZip can read; also DotNetZip can produce zip files that WinRAR can read.


Nov 16, 2010 at 6:37 AM

Cheeso,  thanks for the reply. I have read through the document again and notice that only zip file supported.

Jun 27, 2012 at 9:23 AM

Hi Cheeso,

I am getting the similar error when trying to run the zipped exe that is created by Ionic 1.9. I have a folder in which 3 files total size 470mb.I have to create zipped exe for this folder . Zip exe is created fine. this exe need to be downloaded by client browser.After the client downloaded this exe ,then unable to run or extract this exe. when try to run this exe,he is getting the error as

exception while resetting size Ionic.Zip.ZipException: Cannot read that as a ZipFile ---> Ionic.Zip.BadReadException:   Bad signature (0x00905A4D) at position  0x00000000

The code below is :

-- creating zip exe code
                    Using zip1 As New ZipFile()

                        zip1.AlternateEncodingUsage = Ionic.Zip.ZipOption.Always
                        zip1.AlternateEncoding = Text.Encoding.UTF8

                        zip1.UseZip64WhenSaving = Zip64Option.AsNecessary
                        zip1.Comment = "This will be embedded into a self-extracting exe"

                        Dim sSaveOption As New SelfExtractorSaveOptions
                        sSaveOption.Flavor = SelfExtractorFlavor.WinFormsApplication
                        sSaveOption.Quiet = False

                        zip1.SaveSelfExtractor(StageDir & "\" & sTargetFile & ".exe", sSaveOption)

                    End Using


--- the downloading exe code

            filename = "ABC.exe" ' zipped exe created using at server

            strStagingPath = "\\servername\" & filename
            'downloadexe(strStagingPath, filename)

            'strStagingPath = Application("AnswerLinkPublicRoot") & "\staging\" & filename
            'strStagingPath = "\\inhyvwxtreamspt\eservice\webs\es\public\staging\" & filename
            Dim strContentType As String = "application/octet-stream"

            Response.AddHeader("Content-disposition", "attachment; filename=" & filename)
            Response.ContentType = strContentType

please help me