Questions tagged [dotnetzip]

Questions dealing with the DotNetZip open-source zip library for .NET

DotNetZip is an open source zip library. DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Silverlight is also supported.

Below is an example of using the library with C#:

 using (ZipFile zip = new ZipFile())
 {
     // add this map file into the "images" directory in the zip archive
     zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
     // add the report into a different directory in the archive
     zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
     zip.AddFile("ReadMe.txt");
     zip.Save("MyZipFile.zip");
 }

Note: Just for reference the project builds into Ionic.Zip.dll

Installation

DotNetZip can most easily be installed through its NuGet package.

Install-Package DotNetZip
460 questions
0
votes
1 answer

DotNetZip Exception Bad state (invalid literal/length code)

NET MVC 4 application and in this app I have to download multiple files represented by a List of byte arrays in a Zip file , so I used the DotNetZip library. when I execute this piece if code : using (MemoryStream ms = new MemoryStream()) …
Haytham
  • 834
  • 1
  • 12
  • 31
0
votes
0 answers

cloudfront cdn download files as zip c#

I need to download images from my CDN server, not from my web server. So is there any way to download images as ZIP from CDN server EX. http://testcreative.co.uk/wp-content/uploads/2017/10/Test-Logo-Small-Black-transparent-1.png I can't use server…
AZHAR
  • 11
  • 1
0
votes
0 answers

Access Denied Error DotNetZip ASP.NET MVC C#

I am trying to download a password encrypted zip file that gets created on button push using dotnetzip. On button push, I hit my report controller and call this function [HttpGet] [OutputCache(Duration = 60, VaryByParam = "none", Location =…
Carpathea
  • 97
  • 9
0
votes
0 answers

zip a text file with password C#

I am a newbie to C# and want to zip a file with password. After googling I found about DotNetZip and tried the following but it doesnt work. What other options can I try to zip with password in c#? using Ionic.Zip; namespace CSLab { class…
user2399453
  • 2,930
  • 5
  • 33
  • 60
0
votes
0 answers

Zipping a file using DotNetZip on C# on mac

I am trying to zip a file or directory in C# using the following snippet of code on a mac that uses DotNetZip. But I get some exceptions below, what am I doing wrong? using Ionic.Zip; namespace CSLab { class Program { static void…
user2399453
  • 2,930
  • 5
  • 33
  • 60
0
votes
1 answer

Server cannot append header after http headers have been sent [DotNetZip lib]

I have a table named Logs that has different records stored based on the Machine1 column, ** I am trying to achieve** To export Today's records for a specific Machine1 column, so far this snippet works for once, but for the second iteration is…
user9046719
0
votes
1 answer

Using DotNetZip with powershell

I'm trying to use DotNetZip library from powershell. I downloaded DotNetZip and extracted the Tools folder (containing the Ionic.Zip.dll) to C:\Files. All I need is to extract a splitted .zip file, however, when I try to use…
Noam
  • 1,640
  • 4
  • 26
  • 55
0
votes
1 answer

DotNetZip wrong password while unzipping

Scenario: upload file than try zip it using DotNetZip with password protection, password is generated with Membership.GeneratePassword() method. Everything is working fine except that sometimes user is not able to unzip files with generated…
Mony
  • 93
  • 1
  • 11
0
votes
1 answer

Converting DotNetZip memory stream to string

I am trying to read a file within a zip to check if that file has a certain string in it. But I can seem to get the "file" (memory stream) into a string in order to search it. When I use the following code "stringOfStream" is always blank, what am I…
chrispepper1989
  • 2,100
  • 2
  • 23
  • 48
0
votes
2 answers

Add a .dll source to use classes

Im coding in c#. already written a portable console application that needs a dll to work with and it works perfect without any error. I want to get rid of carrying that dll everywhere and copy its source or some of its classes. Im already using…
0
votes
0 answers

Issue with Returning Epplus spreadsheets with an Image in .zip file using DotNetZip

This scenario works fine without any images on the spreadsheet, but after attempting to add an image to the spreadsheets that get put in the zip file, the spreadsheets open with the excel error of "We found a problem with some content ....". I have…
amartin
  • 330
  • 2
  • 4
  • 17
0
votes
0 answers

Ionic.zip extraction failing - DirectoryNotFoundException

I'm trying to extract a zip file using DotNetZip. Whenever I try to extract an existing zip file with a path, I get a DirectoryNotFoundException. The path I am passing in gets changed for some reason, causing the DirectoryNotFoundException. I'm…
Roka545
  • 3,404
  • 20
  • 62
  • 106
0
votes
0 answers

Compression level, Obfuscation and password in c# DotNetZip library

Here i am using this code to set maximum compression level, Obfuscate files contents (at least for .txt files) inside the output zip and to set password for the output zip file name prevent user from seeing files inside the zip: zip.Password =…
user6364694
0
votes
1 answer

GZipStream delivers zero byte file

I am using DotNetZip's GZipStream to zip a file. The problem I have is that the resulting file is empty. I tried flushing/closing streams, but without result. Anyone knows what I do wrong: using (var outputStream = new FileStream(path + fileName +…
Kees
  • 1,408
  • 1
  • 15
  • 27
0
votes
1 answer

Compressing pdf files with DotNetZip returns damaged archive

I'm trying to compress 2 pdf files using DotNetZip with this code: void Main() { byte[] file1 = File.ReadAllBytes(@"C:\temp\a.pdf"); byte[] file2 = File.ReadAllBytes(@"C:\temp\b.pdf"); //byte[] file3 =…
Phate01
  • 2,499
  • 2
  • 30
  • 55