Situation: I am creating a file, I want access to be restricted. The only access rights that should be granted are:
- Creator: Full access
- Everyone else: No access
This is a windows console application.
Current code:
string secretFile = string.Format("{0}_secret.txt", System.Security.Principal.WindowsIdentity.GetCurrent().Name);
if(!File.Exists(secretFile))
{
File.Create(secretFile);
System.Security.AccessControl.FileSecurity fileSec = //What do I do here?
}