how to remove access from a folder

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Dear all
I am developing an application to give acess to a folder like read, write etc and also i need to remove access from the folder form a pirticular user
I have given access to a folder using the following code
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; Dim dInfo <span style="color:Blue; As <span style="color:Blue; New DirectoryInfo(CurrentPath)
<span style="color:Blue; Dim dSecInfo <span style="color:Blue; As DirectorySecurity = dInfo.GetAccessControl(AccessControlSections.Access)
<span style="color:Blue; Dim myRuleValue <span style="color:Blue; As <span style="color:Blue; Integer = 0

myRuleValue = FileSystemRights.Write <span style="color:Green; Add your wanted Access here
<span style="color:Blue; Dim myRule <span style="color:Blue; As <span style="color:Blue; New FileSystemAccessRule(UserName, myRuleValue, InheritanceFlags.ContainerInherit <span style="color:Blue; Or InheritanceFlags.ObjectInherit <span style="color:Blue; Or InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow)

dSecInfo.AddAccessRule(myRule)
dSecInfo.SetAccessRule(myRule)
dInfo.SetAccessControl(dSecInfo)

[/code]
can any one give me an idea of how to remove access form a pirticular folder

View the full article
 
Back
Top