C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

UnauthorizedAccessException in ExtractFolder method

rated by 0 users
This post has 1 Reply | 1 Follower

Top 500 Contributor
Posts 14
to_sam Posted: Mon, Nov 19 2007 8:57 AM

I have a zip archive with subfolders. For example, in TotalCommander there is:

DIAG_CONTAINER.zip\template\xyz\src\params\MyParam.xml

I want to extract the whole DIAG_CONTAINER.zip into a new folder DIAG_CONTAINER and preserve the hierarchy of the files and folders. I use this code:

                    zipFile.Open(sourceFile);
                    zipFile.Entries.ExtractFolder(destFolder);

But the last call throws an UnauthorizedAccessException saying that the directory "DIAG_CONTAINER\template" cannot be accessed. I checked via TotalCommander that the created directory is set to ReadOnly and it seems that no files can be copied into it. When the method "ExtractFolder" is called, does it create the new folders as ReadOnly?

Top 25 Contributor
Posts 455
Hi,
 
I have used the same code to extract the folder [sample attached] and it runs perfectly on my side. Are you trying this out on a Web Application?
 
Please find the attached sample.
 
Thanks,
~Gary.
<to_sam> wrote in message news:199787@10.0.1.98...

I have a zip archive with subfolders. For example, in TotalCommander there is:

DIAG_CONTAINER.zip\template\xyz\src\params\MyParam.xml

I want to extract the whole DIAG_CONTAINER.zip into a new folder DIAG_CONTAINER and preserve the hierarchy of the files and folders. I use this code:

                    zipFile.Open(sourceFile);
                    zipFile.Entries.ExtractFolder(destFolder);

But the last call throws an UnauthorizedAccessException saying that the directory "DIAG_CONTAINER\template" cannot be accessed. I checked via TotalCommander that the created directory is set to ReadOnly and it seems that no files can be copied into it. When the method "ExtractFolder" is called, does it create the new folders as ReadOnly?



http://helpcentral.componentone.com/cs/forums/p/73595/199787.aspx#199787

Page 1 of 1 (2 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.