Duh … The previous post on this subject has simply disappeared (I should say I was testing w.bloggar…). Here is what was said.
This tool (provided with source) is an IHttpHandler sample that, once installed on an Internet Information Server, allows client browsers to browse .Zip files seamlessly.
Directories in the ZIP file are shown (by default – this setting can be switched off) the same way that IIS shows “real” directories. If the users browses any file in the .Zip archive file, the file will be downloaded naturally (with proper handling of Last-Modified Http headers).
This handler can also use a cache directory to speed things up.
For reading .ZIP files, it is based on the famous http://www.zlib.org accessed through P/Invoke call (it is actually a special version I have very slightly modified that does not force us to use UNSAFE C# compilation. I can provide the modified source for those who would like to have it). By the way, the code provides a full blown unzip C# interface that can be reused in non HTTP contexts. Updating and creating .ZIP file is not handled, only reading.
Binaries and source code are available here http://www.codefluent.com/smourier/zhh.htm.
Note: the links proposed for the demo are defined as .vsdisco file, this is to avoid defining a new association between ASP.Net’s ISAPI filter (aspnet_isapi.dll) and .ZIP (less work for hosters).
There was a question from Don Box about the performance between zlib and the Zip classes provided with J# redist. I would hardly imagine the J# implementation being faster than the zlib I used. This zlib (32bits X86) has been specially optimized with asm code. See http://www.winimage.com/zLibDll/unzip.html for more on this.