locked
blocked zip files using zipsharp library RRS feed

  • Question

  • I had a program created in C#.net that zips a folder up for me automatically.

    We used the zipsharp library and it seems to work great execpt when  you try to open it using windows to extract the files from the zip.

    If you try to extract the files you get a message saying "windows has blocked access to these files to protect your computer" and it tells you you can fix this by right clicking the zip file and go to properties and check the "unblock" box and all will be fixed.  However there is no "unblock" option anywhere.

    I can use winzip or winrar to open and extract the file just fine but windows will not work.

    It seems to be something that XP is looking for in the zip file that flags it as being safe or not but I don't know what it is or where to find it.  I think this started after the release of SP2 for XP

    If I just use windows to create a zip file on my computer, I can open and extract it just fine.

    Any help would be GREATLY appreciated!!!!

    Thanks,

    Kory

    Monday, January 30, 2006 9:16 PM

Answers

  •   I had the same problem (apparently empty zip file in windows XP)  When I zipped using a relative path the zipSharpLibrary created zip files I could explore with windows. 

     

    Saturday, February 11, 2006 2:32 PM

All replies

  • The unblock option is in the properties for the file.  Windows will do this for any file that comes from the web.  Yes, it's new in SP2, and yes, I find it really annoying too, but I'm sure one of these days it will save my bacon :-)

     

    Monday, January 30, 2006 10:54 PM
  • Actually the unblock option is not there.  Like I said in my first post, thats the problem.  If I had the unblock option in the file's properties, I would check it and be on my way, but the option does not appear at all.

    I need to know why, and how to fix it.  I need access to this file without the use of a 3rd party zip program.

    Thanks,

    Monday, January 30, 2006 11:13 PM
  • I've just downloaded this library and tested it.  I found that my zip opened in XP SP2, but showed up empty, the files were there in WinZip.

    If you use a free library, you have two choices, they are contact the author, and get the source code and try to fix it.  If you're writing a commercial application, you may want to investigate a commercial zip library.  If you're writing something for yourself, I'd contact the author and see if he offers any support.

     

    Monday, January 30, 2006 11:35 PM
  • Did you ever find a resolution to this? I am having a similar issue although unrelated to yours. I NEED to be able to allow a person to execute a self extracting zip file from a web page. Windows 2003 won't allow this because it blocks it. Is there any way to turn the behavior off?
    Thursday, February 9, 2006 9:59 PM
  • Not yet... but I actually have someone at Microsoft working on the issue.  I was able to get the attention of someone in development there who was able to recreate the issue and they are now working on it.

    I haven't gotten a status report in a few days, so maybe I'll email them today and see whats up...

    I'll keep you posted though...

    Friday, February 10, 2006 1:43 PM
  • This doesn't appear to be an isolated instance of the problem. I have a client with nearly precisely the same problem with zip files. Googling for an answer has yielded only others with the same problem and no solution.
    Friday, February 10, 2006 3:57 PM
  • This is very frustrating. I can't believe Microsoft would put this kind of security feature in place and not have a way to disable it. I really hope someone can get this resolved.
    Friday, February 10, 2006 4:24 PM
  • In trying to replicate this problem, I downloaded a ZIP file from some random site on the internet using IE and was able to open it with Windows Explorer/Compressed Folders and extract the contents with no problem. Could the issue be related to the affected machines not being fully patched?  Any hints as to how I may replicate this problem?

    My test system is XP SP2, full latest patches, firewall on.I was logged in as a regular User.

    An addendum.  I checked the Properties of my downloaded ZIP file and there *was* an "Unblock" option in the lower right corner of the General tab.

    Friday, February 10, 2006 5:07 PM
  • It doesn't have to do with not being fully patched, because I am.  I can recreate the issue on XPpro SP2 and server 2003 both fully patched.

    The issue seems to be related with either what program "created" the zip, or how said program creates the zip file. 

    My guess is that the programs, or in my case a c# zip library, isn't creating something that windows looks for to tell the OS that this file is "safe" and because windows doesn't see that, it doesn't even give the option to unblock it.

    I can create zip files in windows using windows compression all day and open them just fine.  99.9% of the zip files you download will work too, but for whatever reason, there seems to be a few files, created by a few programs that windows just can't open.

    Friday, February 10, 2006 7:02 PM
  • A very easy way to test this is to find a website that has an executable zip file for download. Instead of downloading it tell it to open. If you do this even as an administrator it will block it. I have several 2003 SP1 machine here that all expierence it.
    Friday, February 10, 2006 7:08 PM
  • Could you send me a sample (problematic) ZIP file created with the ZipSharp library?

    email is:

    EEthrowaway@gmail.com


    Friday, February 10, 2006 9:04 PM
  • Here is a zip file that I created using the library.

    It should have one .txt file in it.  You should be able to use winzip to open it, but windows will not allow you.

    <link removed>

    Saturday, February 11, 2006 12:45 AM
  • If you zip using the full path Windows XP will not be happy.

    use a relative path when zipping.

    http://community.sharpdevelop.net/forums/thread/4532.aspx

    Saturday, February 11, 2006 3:23 AM
  • I said: The "full pathname" has nothing to do with this issue.

    Bah, forget it.  Didn't know what I was talking about.  Look further down.
    Saturday, February 11, 2006 7:15 AM
  •   I had the same problem (apparently empty zip file in windows XP)  When I zipped using a relative path the zipSharpLibrary created zip files I could explore with windows. 

     

    Saturday, February 11, 2006 2:32 PM
  • stewart05, Kar Tarbet is correct.  I don't know why WinZip would like it at all (with the fullpath).

    PKZip 2.5 doesn't like it either. Here's its response to stewart05's example file:

    Extracting files from .ZIP: badzip.zip
    PKZIP: (W2) Warning! illegal path or drive specified: c:/new folder/New Text Doc
    ument.txt

    PKZIP: (E9) No file(s) found


    ----------------------------------------------

    If I zip a similar text file using PKZip 2.5 and *its* full path option, the stored filename (in the ZIP file) looks like this: "new folder/test.txt"

    whereas in stewart05's example, the the stored filename looks like this: "c:\new folder\New Text Document.txt"

    I consider it a bug in the SharpZipLib that needs fixing.

    Wednesday, February 15, 2006 8:48 PM
  • Just so everyone knows, Karl was right.  I finallay got the programmer to take a look at how she was storing the file paths in the zip files and she was storing the full path.  She changed that and now we can use windows to view and extract the zip files.  I do think that Microsoft needs to take a look at this, but its working now.

    Thanks for ALL your help everyone!!!!!!

    Wednesday, February 22, 2006 2:28 PM
  • Had the same problem but as a recipient - was trying to install fujitsu drivers on my laptop to take to a client on their desktop. Couldn't see the contents of the folder on XP and got "Windows has blocked access to these files to help to protect your computer ".  Used another machine (Win2K) to burn zip file to disk (had winzip on it) and all seemed well.  Client had XP, totally different set up to mine and same problem.  Installed WinRAR and bingo - all well

    Tuesday, August 1, 2006 3:09 PM
  • Hi, sorry if I am reviving this post from long ago, I found it using the search engine.

     

    I was curious, is there a way to disable this auto block thing in windows?

    I had the problem on xp, I am now on vista.. it just gets so tiresome having to keep unblocking stuff.

     

    I'd appreciate a way of disabling that Smile thanks.

    Monday, December 31, 2007 7:13 PM
  • I am having the same issue on a Windows 2003 SP2 Terminal server.  I downloaded some software from Citrix that is in Zip format.  When I tried to uncompress I received

     

     "windows has blocked access to these files to help protect your computer"

     

    I did have an "unblock" button in the properties of the .zip file.  I clicked "unblock"  but all that did was make the button disappear.  The file still will not extract and I still get the "windows has blocked access to these files to help protect your computer" message.

    Friday, January 4, 2008 8:52 PM
  • All,

     

    I'll try to be as brief as possible, but I also want to be thorough, so here goes...

     

    I am an ASP.NET / VB.NET programmer with the same issues you guys were describing. I am using the SharpZipLib component to compress a file before streaming it to the user. It was working fine for me because I use WinZip, but my boss was SOL trying to open it in the built-in Windows archiver.

     

    Based on the content of this thread, I decided to take a look at my code again. Sure enough, I was zipping the file using the full path. Now, this is a little complicated because the file I am zipping exists in a very different location from where my code is running... So what I did was use File.Copy to move the file into my code folder, then ZIP it using only the filename (no pathing, defaulting to program folder) and move the completed ZIP file to the folder I needed it in using File.Move.

     

    *BANG*

     

    Worked like a charm. Fully functional now.

     

    For those of you who are simply trying to open someone else's ZIP, I'm not sure what to tell you. WinZip seems to open fully pathed files without an issue, so I would try that.

     

    Hope this info helps.

    Thursday, January 10, 2008 5:53 PM
  •  Karl Tarbet wrote:

      I had the same problem (apparently empty zip file in windows XP)  When I zipped using a relative path the zipSharpLibrary created zip files I could explore with windows. 

     

     

    Many thanks, Karl. Your post lead me down the right path and saved me hours (maybe days) of frustration.

    Thursday, January 10, 2008 5:56 PM
  • I had same problem and solution was to add line:
    entry.Size = binFile.Length;

    working sample:
    ....
    entry.DateTime = DateTime.Now;
    entry.Size = binFile.Length;
    s.PutNextEntry(entry);
    ....

    • Proposed as answer by rayhaypoboy Thursday, January 5, 2012 12:07 AM
    Tuesday, January 15, 2008 5:05 PM
  • Tuesday, February 19, 2008 5:28 AM
  • This is all much much simpler in DotNetZip.
    With DotNetZip, there is no possibility to create a zip file that is unreadable.
    If you try to store an entry with the full path, DotNetZip is smart about it and will trim the drive letter (or UNC prefix), making it a legal ZIP file, regardless.

    Sample code for creating a zip:

      using (ZipFile zip = new ZipFile())  
      {  
          zip.AddSelectedFiles("*.csv");  
          zip.Save(PathToZipArchive);  
      }  
             


    Here you can browse the reference doc for DotNetZip.

    • Proposed as answer by cheeso Monday, March 9, 2009 5:27 PM
    Monday, March 9, 2009 5:27 PM
  • Hi at all,

    by using the ICSharpCode.SharpZipLib.dll, I experienced the same issue that zipped files couldn't be opened with the in Windows integrated zip handling mechanism. Therefore I searched in the web and also found this thread. Unfortunately, using relative paths didn't fix the issue.

    On further research on the web I also found the following blog, which presents the solution and additional information about similar issues:

    http://jamesewelch.wordpress.com/2008/12/03/sharpziplib-and-windows-extraction-wizard-errors/

    Better than use relative paths is to use the provided method for clearing filename to add files.

     

    ZipEntry entry = new
    ZipEntry(ZipEntry.CleanName(strFile2));
    

    That finally helped me to fix it.

    • Proposed as answer by Marcel Isenmann Wednesday, September 22, 2010 7:43 AM
    Tuesday, September 21, 2010 1:58 PM