windows file permissions

Jan 12, 2010 at 7:26 PM

I am using Ionic.Utils.Zip in a asp.net web app and it is working great. 

However, the  zip files are not inheriting the windows file permissions of the it's parent folder.  Is there a way to fix this?

Thanks!

 

Coordinator
Jan 12, 2010 at 7:45 PM

First, if you're using Ionic.Utils.Zip, you are using a very old version of DotNetZip.  In older versions (v1.6 and prior) the zip file was created in a temp file folder, and then moved to the final location.  This could cause what you are reporting.  The v1.9 release does not do it this way, partly because other people complained about the permissions issue.

So, I suggest that you upgrade to the v1.9 release.

AFTER YOU UPGRADE, test it again.

If after you upgrade, the problem still occurs, give me more details.

What happens if you just create a file in the directory, without using DotNetZip?

 

 

Jan 12, 2010 at 7:51 PM

Hi, I am using  Ionic.Utils.Zip from 11/2008. 

I just downloaded the lastest version, but I don't see an Ionic.Utils.Zip in the package, is there another package I should download?

Thanks!

 

 

Coordinator
Jan 12, 2010 at 8:31 PM

The DLL has been renamed Ionic.Zip.DLL.

Therre is no Ionic.Utils.Zip.DLL.    The namespace has changed as well, in the same way. 

Jan 12, 2010 at 8:36 PM

Oh ok, I see...so I added the new dll reference to my project, and I changed the namespace in my code, recompiled, but I am still having the same issue where the newly created ZIP file does not have the same permissions as it's parent folder.

BTW, I am using it like this:

Dim strZipFileName As String = strNewPath & "\" & zipFileName & ".zip"
        Dim zip As ZipFile
        Dim dirToZip As String = strNewPath
        Try
            If System.IO.File.Exists(strZipFileName) Then
                System.IO.File.Delete(strZipFileName)
            End If
            zip = New ZipFile(strZipFileName)
            'Response.Write("Path:" & dirToZip & "<br><br>")
            zip.AddDirectory(dirToZip)
            zip.Save()

 The dirToZip folder is the parent folder and the one with all the proper permissions. 

  I am not sure if that has anything to do with it.

 

Thanks!

 

 

Coordinator
Jan 12, 2010 at 8:55 PM

You need to enclose the ZipFile object in a Using clause.  See any code snip I have ever provided for an example.

Also - I don't know what you mean by "dirToZip is the parent folder" .  But... If the zipfile is saved into the folder it is zipping, things can get messy.  Don't do that.

Also what happens if you create a text file in the same directory.  Does it behave differently from the ZIP file with respect to the inherited permissions.