I'm using C# 4.0. I have a folder "C:\Users\leal\AppData\Roaming\MyApp". The permissions on this folder let Everyone have full access to it. My program creates a file "MyDB.bak" in that folder. When I try to run a restore from SQL Server, I get the error
Cannot open backup device 'C:\Users\leal\AppData\Roaming\Myapp\MyDB.bak'. Operating system error 5(Access is denied.).
The problem is that Everyone does not have access to this file. I know I could explicitly give permissions to MyDB.bak, but I'd prefer to set it up so that files created in the folder inherit the folder's security attributes. Can I do this?