I have been trying to password protect an archive using the dotnetzip library. My code executes, and and the archive is created with all the files present, however, the password has not been applied to the file.
Interestingly, this also happens when I use the code snippets, directly from the developer's website.
Any help would be greatly appreciated.
Here's the modified code that i have been using from the developer's website. I believe this should password protect each file within the archive. I would also be happy if anyone could suggest a way to only password protect the archive, only - opposed to the individual files:
using (ZipFile zip = new ZipFile())
{
zip.Password = "123456!";
zip.AddFile(@"C:\Users\USERX\Desktop\c# zip two files together\file with prefix\Prefix - USERX.docx");
zip.AddFile(@"C:\Users\USERX\Desktop\c# zip two files together\file without prefix\USERX.docx");
zip.Save(@"C:\users\USER\Desktop\c# zip two files together\zip file output\thefilename");
}
I replaced the files that i was trying to password protect with a file that had text in it. It solved the problem.