Tschuikow 0 Newbie Poster

When I run this Code, the access is denied for all users, my current login too.

Dim di As New IO.DirectoryInfo("c:\folder")
Dim ds As DirectorySecurity = di.GetAccessControl()

             
ds.SetOwner(WindowsIdentity.GetCurrent().User)

ds.AddAccessRule(New FileSystemAccessRule(WindowsIdentity.GetCurrent().Name, FileSystemRights.FullControl, AccessControlType.Allow))

             

ds.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Deny))


di.SetAccessControl(ds)

How do I deny access for folder for all users, except for one?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.