开发者

getting access to the path denied while saving a zip file using DotNetZip library

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.TempFile开发者_运维问答Folder = "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 TempFileFolder are not escaped which might cause a problem. Try using a verbatim string literal instead.

zipFile.TempFileFolder = @"D:\Company Data\Operations\media\test_folder_cover_scan\"

Also, the tempFilePath in 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?


It looks like you don't have access to where you are trying to save it to. Try opening the command prompt and typing

takeown /f D:\Company Data\Operations\media\test_folder_cover_scan

That should give you ownership to the folder you are trying to save the file to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜