C# windows forms app change permissions on MDB file
Posted on 2011-02-25
I have a windows application written in C#. I use InstallAware as the packager and all seems to go well on install. I have an access database file as the data store of the application which is stored in the Program Data section of the users machine which allows full write capabilities etc. My problem is that i cannot get the permissions i apply to the file to stay after the install.
Once installed, the program auto-starts and queries user for info which is written to the application no problem. The Security permissions on the file are set to Full Control for everyone on install correctly. The problem happens once the application is closed and restarted. The database file then has the permissions stripped to only read & execute and read for the Users group.
I have to physically go in and add the write permission and all runs fine after that but i do not want to have end users doing this.
Can someone help me with code to assign permissions to all users or users for at LEAST read/write?
Thanks in advance!