UnauthorizedAccessException in ExtractFolder method

WinForms

ComponentOne's WinForms controls

UnauthorizedAccessException in ExtractFolder method

  • rated by 0 users
  • This post has 1 Reply |
  • 1 Follower
  • 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?

  • how to include subfolder.zip
    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)