c# - ICSharpCode.SharpZipLib.Zip crc32 -


I'm using to write compressed and response.Binary the ICSharpCode.SharpZipLib.Zip'm using files and folders as MemoryStream In order to pass this

Here is my code:

  MemoryStream DF = new MemoryStream (); ZipOutputStream s = new zipoutputstream (DF); S.SetLevel (9); Byte [] data = (byte []) file. OpenBinary (); S.Write (Data, 0, Data. Lang); S.Finish (); S.Close (); Byte [] outBuf = df.GetBuffer (); reaction. Expere = 0; reaction. Buffer = true; Response.ClearContent (); Response.AddHeader ( "content-disposition", "inline; filename =" out.zip "); Response.ContentType =" application / zip "; Response.BinaryWrite (outBuf); HttpContext.Current.ApplicationInstance.CompleteRequest ();   

when I try to open out.zip file, it goes without saying that the zip file is either corrupted or damaged, and looking as CRC value 000,000.

what is the solution to this? Why is this error?

I would guess a lot, you want to call Hia:

  s.Flush (); df.Flush ();   

Just before you call df.GetBuffer () < / Code>

Comments