A
A
Andrey Tatarnikov2014-03-11 14:31:30
.NET
Andrey Tatarnikov, 2014-03-11 14:31:30

DotNetZip crashes when creating multi-volume archives, why?

Let me leave here a link to this stackoverflow question: goo.gl/LZmURA
I'm trying to create a multi-volume archive, while the first volume is always created successfully, and when trying to create the second volume, the error "System.UnauthorizedAccessException: Access to the path is denied" occurs.
I tried everything that was enough for imagination - no use. Please help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mayorovp, 2014-03-11
@crackpot

Let me give you some advice on the code.
Instead of

if (!Directory.Exists(zipFolder)) Directory.CreateDirectory(zipFolder);
if (!Directory.Exists(TaskZipFolder)) Directory.CreateDirectory(TaskZipFolder);
it was possible to write simply Directory.CreateDirectory(TaskZipFolder);
All necessary checks are already made inside.
And the error occurs due to the fact that incomplete archive segments are placed in a temporary folder instead of the current one. If access is closed there - that's your mistake. I advise you to find another library for creating archives, since suddenly working with files in a temporary folder is a potential security hole. (In particular, the temporary folder is shared between privileged and non-privileged administrators when UAC is enabled)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question