Reputation: 2783
After generating a file, I don't want to allow anyone to open it.
Upvotes: 0
Views: 2591
Reputation: 908
What are you trying to protect and who are you protecting it from?
If you're going to put your credit card number in it and ship it off to the Russian Mob, then you'd need rather strong encryption. If you're trying to obfuscate the contents from standard users, a simple ASCII shift would be OK.
.Net has encryption routines built in. The Code Project (nice site, by the way) has a good article those encryption routines here.
If you're the administrator of the machine, and those you are trying to protect the contents from are not administrators, then simply change the permissions of the file.
Upvotes: 2
Reputation: 3461
You have a couple of options.
1) You could Encrypt the file. Then even if people can open the file they won't be able to read it.
2) Zip it up and password protect it. See dotnetzip from codeplex.
Upvotes: 1
Reputation: 498914
A CSV file is just a text file. It doesn't have any protection of its own.
You could encrypt it, or zip it up (with a password), for example. But then you will need to decrypt it/unzip it before you could use it.
Upvotes: 1