Set Write Permissions for a Group - VB.NET
Posted on 2009-07-02
Hi Experts Exchange!
I'm trying to do something that seems pretty simple to me, however, after a couple hours of research I can't seem to find exactly what I need.
I'm creating an xml file, to store some settings, in the [My.Computer.FileSystem.SpecialDirectories.AllUsersApplicationData] directory of windows. The file is created without any problems, however, the "Users" group is only given Read & Excecute permissions to the file. So, when another user runs my program and attempts to modify the the .xml file, a security permissions error is thrown.
Here's what I need to do...
I need to change the file's permissions for the "Users" group, and allow write access to the .xml file. I'd also like to do this immediately after the file's creation.
Just an FYI; this in no way creates any security threat for my application. Not only is my .xml file encrypted, but the settings stored inside the .xml file are of an inconsequential nature. It's encrypted simply for the peace of mind associated with basic security through obfuscation.
That's pretty straight forward right? I'm sure plenty of you guys have changed windows security permissions at the group level before.
A note...I did try assigning the attribute <PermissionSetAttribute(SecurityAction.Demand, Name:="FullTrust")> to my methods, however this was not successful.
If you have any questions, please feel free to ask away!
Much thanks! =)