Example code:
Using Zip As ZipFile = New ZipFile()
Zip.AddFile("E:\Projects\HOPS\HOPS v1.56\Website\Photos\Pubs.zip")
Zip.MaxOutputSegmentSize = 20 * 1024 * 1024
Zip.TempFileFolder = "E:\Temp\Photos\Temp"
Zip.Save("E:\Temp\Photos\Archive.zip")
End Using
Generates the following error message:
Access to the path is denied.
Comment out the Zip.MaxOutputSegmentSize line and the code works generating a single zip file. When it fails, it has managed to create the file .z01 file. I don't think it's a permissions problems on the target folder because I've given "Everyone" full access to try and get it working plus it's able to create it when not attempting to break into 20MB chunks.
The full error message is this:
[UnauthorizedAccessException: Access to the path is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +10556971 System.IO.File.Move(String sourceFileName, String destFileName) +351
Ionic.Zip.ZipSegmentedStream.TruncateBackward(UInt32 diskNumber, Int64 offset) +694 Ionic.Zip.ZipEntry.Write(Stream s) +1302
Ionic.Zip.ZipFile.Save() +1162 Ionic.Zip.ZipFile.Save(String fileName) +366 PhotoImport.Page_Load(Object sender, EventArgs e) in E:\Projects\HOPS\HOPS v1.56\Website\Pubs\PhotoImport.aspx.vb:48
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
Later - bit more information from Process Monitor:
w3wp.exe CreateFile C:\Windows\System32\inetsrv ACCESS DENIED
Hmm, why is it trying to write to that folder?