soousky
asked on
How to set/change folder permission in VB .NET 3.5
Hi,
I am trying to change a folder (and all its sub folders and files) permission in Visual studio 2008 and VB .Net 3.5. Also I can not use windows AD as it is not implemented.
What is the best way to do this?
I have looked around and there is some information about setting file/folder permissions s but its all older stuff and I hear there is new way to do this in VS 2008. But I can not find it.
What I want to do it change a folder (and all files and sub files) permission to full access do stuff and then change it to read only and execute.
I am doing this using Visual Basic and .NET 3.5.
Thanks
I am trying to change a folder (and all its sub folders and files) permission in Visual studio 2008 and VB .Net 3.5. Also I can not use windows AD as it is not implemented.
What is the best way to do this?
I have looked around and there is some information about setting file/folder permissions s but its all older stuff and I hear there is new way to do this in VS 2008. But I can not find it.
What I want to do it change a folder (and all files and sub files) permission to full access do stuff and then change it to read only and execute.
I am doing this using Visual Basic and .NET 3.5.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Good code, just one comment, this line needs to have a comma after UserName:
myRule = New FileSystemAccessRule(UserN ame myRuleValue, InheritanceFlags.Container Inherit Or InheritanceFlags.ObjectInh erit Or InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)
dSecInfo.AddAccessRule(myR ule)
dSecInfo.SetAccessRule(myR ule)
dInfo.SetAccessControl(dSe cInfo)
Open in New Window Select All
myRule = New FileSystemAccessRule(UserN
dSecInfo.AddAccessRule(myR
dSecInfo.SetAccessRule(myR
dInfo.SetAccessControl(dSe
Open in New Window Select All
This worked great!
ASKER