in

C1 Community

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

UnauthorizedAccessException in ExtractFolder method

Last post 02-20-2008 7:52 AM by C1_GaryB. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-19-2007 8:57 AM

    UnauthorizedAccessException in ExtractFolder method

    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?

  • 02-20-2008 7:52 AM In reply to

    Re: UnauthorizedAccessException in ExtractFolder method

    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)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.