ZipError event

Mar 29, 2010 at 5:09 PM

 

Hi, when i trying add local disk into Zip i have "Unauthorized access exception", i read the documentation, but not find solution. 
Maybe you can help me.
private void zipFile()
        {
            using (zip = new ZipFile())
            {
                zip.ZipError += new EventHandler<ZipErrorEventArgs>(zip_ZipError);
                zip.ZipErrorAction = ZipErrorAction.InvokeErrorEvent;
                zip.AddDirectory(@"C:\");
                zip.Save(@"D:\test.zip");

            }
        }
        private void zip_ZipError(object sender, ZipErrorEventArgs e)
        {
            MessageBox.Show(e.Exception.Message);
            this.Close();
        }
Best Regards, Sergey

 

Coordinator
Mar 29, 2010 at 11:45 PM

Sergey,

It's possible you lack access to read or open the file you are trying to zip. It's also possible you lack the permissions to write to d:\test.zip.  I can't tell.

You haven't given me an exception stack trace.  You've only given me a message.  That's not enough information to diagnose the situation.

Mar 30, 2010 at 8:40 AM

Dear Cheeso,

maybe i have set my question incorrect. In previos code sample if i have errors in zip should appear a message, but i have exception. For example, when i try to zip local disk i have "Unauthorized access exception". If i set zip.ZipErrorAction = ZipErrorAction.Skip i still have exeptions.

Best regards, Segrey 

Coordinator
Mar 30, 2010 at 4:54 PM
Edited Mar 30, 2010 at 9:30 PM

I understand that you have received an unexpected exception.

You haven't given me an exception stack trace.  You've only given me a message.  That's not enough information to diagnose the situation.