string redirectionFolder = @"D:\test\subtest\";
FileSystemAccessRule everyOne = new FileSystemAccessRule("Everyone", FileSystemRights.FullControl,AccessControlType.Allow);
DirectorySecurity dirSecurity = new DirectorySecurity(redirectionFolder, AccessControlSections.Group);
dirSecurity.AddAccessRule(everyOne);
Directory.SetAccessControl(redirectionFolder, dirSecurity);
Note:
If you get the error "Attempted to perform an unauthorized operation"
add the tag (<identity impersonate="true"/>
5 comments:
Thanks for this - it worked a charm!
Ya It worked fine thanks for your post man
If we set the identity impersonate it asking the username and password. what we want to give in that place???
Thanks! I searched everywhere for this.
I think that this would make a great template for my website. I have been looking for something like this. Thanks !
Post a Comment