Access to the path 'C:\WINDOWS\system32\vghuupae.c5z' is denied

May 22, 2008 at 5:51 PM
I get this error when I try and do a

zip.Save()

I am using the component in an ASP.net page.  Everything runs fine right up until the save.

The code is essentially this:
zip = New Ionic.Utils.Zip.ZipFile(Server.MapPath("Export.zip"))
zip.AddFile(Server.MapPath("test.jpg")
zip.Save()
zip.Dispose()
zip = Nothing


Anybody have a solution?  if it helps, the weird filename it's trying to access in system32 changes every time the code is executed!

Cheers



Andy
Coordinator
May 24, 2008 at 7:50 PM
Edited May 24, 2008 at 7:51 PM

YES, I have a solution.

Set the TempFileFolder property on the ZipFile, before saving.  eg
zip = New Ionic.Utils.Zip.ZipFile(Server.MapPath("Export.zip"))
'set this property to the name of a directory the ASP.NET user can write to:
zip.TempFileFolder = "c:\temp"
zip.AddFile(Server.MapPath("test.jpg"))
zip.Save()
zip.Dispose()
zip = Nothing

See the doc on that property for WHY you need to set it.