I am trying to create a zip file and save it using DotNetZip library.
But for some reason i get a “Access to the path is denied” error when i try to save it. Code4 is below
Dim zipFile As New ZipFile()
zipFile.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression
zipFile.AddFile(filePath)
Dim tempFilePath As String = "abc.zip"
zipFile.TempFileFolder = "D:\Company Data\Operations\media\test_folder_cover_scan\"
zipFile.Save(tempFilePath) <== error line
I have given all possible access to the folder. I am using .net 3.5. This whole code works in a web service
Please advise
The backslashes in your
TempFileFolderare not escaped which might cause a problem. Try using a verbatim string literal instead.Also, the
tempFilePathin your example doesn’t include a full path, could it be that it is trying to save the ZIP into a different folder from the one you are expecting (and have assigned permissions to)?Have you assigned permissions to both the temporary file folder AND the real destination folder?