Security violation error on ZipFile.Save()

Sep 4, 2009 at 4:48 PM

I have a vb.net app.  It is running from a network share and working with other folders and files on that network share and other network shares.  It has been signed with a valid key and has no problems running on the share and working with the files on that share and others it has access to.  I am using release 1.8.4.21 of Ionic.Zip.  

The application throws the following error:  "Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed"  when it tries to call the Save function on a ZipFile using the following code:

Using zip as ZipFile = New ZipFile
  For Each s as String In System.IO.Directory.GetFiles(workingfolder, "*.txt")
    zip.AddFile(s, "")
  Next

Works fine up to here, but the next line throws the error:

  zip.Save(filename)

However, if I change the zip.Save(filename) to the following, it works fine:

  Dim ms As New MemoryStream
  zip.Save(ms)
  -- additional code to save the MemoryStream to a file on the network share follows and works fine if I do it that way

So, I figured out a workaround, but the internal ZipFile.Save() doesn't appear to like working with network shares

Coordinator
Sep 4, 2009 at 5:12 PM

Can I see the rest of the exception, in particular, the stacktrace?