Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Dir Permissions programmatically doesn't work

Status
Not open for further replies.

Becks25Not

Programmer
Jun 23, 2004
176
US

Hi All,

I have this code here
Code:
		Dim dir As String = "D:\test\"
		Dim Account As String = "BUILTIN\Users"
		Dim act As Security.AccessControl.AccessControlType = Security.AccessControl.AccessControlType.Allow
		Dim fsar As Security.AccessControl.FileSystemAccessRule = New Security.AccessControl.FileSystemAccessRule(Account, FileSystemRights.Modify, act)
		Dim info As IO.DirectoryInfo = New DirectoryInfo(dir)
		Dim ds As Security.AccessControl.DirectorySecurity = info.GetAccessControl(AccessControlSections.Access)

		ds.AddAccessRule(fsar)
		info.SetAccessControl(ds)

When I run it, if you look at the security on the folder, this new security appears under the Advanced tab. Hoewever, it still does not allow the Users group to Modify. Any ideas?

Thanks in advanced!
Becca

 
I figured this out... it was the right combination of the propagation flags and inheritance to make files and subfolders work as desired!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top