Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to share with Everyone permission, I am using below code
C#
string path = @"F:\Kishfolder";
DirectoryInfo dinfo = new DirectoryInfo(path);
DirectorySecurity dirSecurity = dinfo.GetAccessControl();
FileSystemAccessRule fileRule = new FileSystemAccessRule("Everyone", FileSystemRights.Modify | FileSystemRights.FullControl | FileSystemRights.Synchronize, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow);
           dirSecurity.AddAccessRule(fileRule);
           dirSecurity.SetAccessRule(fileRule);
           Directory.SetAccessControl(path, dirSecurity);
           dinfo.Refresh();

But with this code the folder is only getting Everyone permission not able to access from shared path.
Posted
Updated 11-Dec-12 23:05pm
v2

1 solution

Hi
Please refer below link. This may be useful for you.

http://social.msdn.microsoft.com/Forums/en-SG/windowssdk/thread/de213b61-dc7e-4f33-acdb-893aa96837fa[^]


Regards
Dominic
 
Share this answer
 
Comments
Dominic Abraham 12-Dec-12 8:02am    
If the solution is helpful don't forget to mark it as answer. So that it may help others with similar issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900