Folder permissions set to Everyone, you first need to add a reference
using System.Security.AccessControl;
Use the following method to set the folder permissions to Everyone
/// <Summary> /// Set folder permissions, all the processing for the Everyone permissions /// </ Summary> /// <param name = "foldPath"> folder path </ param> public static void SetFileRole ( String foldPath) { a DirectorySecurity FSEC = new new a DirectorySecurity (); fsec.AddAccessRule ( new new the FileSystemAccessRule ( " the Everyone " , FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Allow)); System.IO.Directory.SetAccessControl (foldPath, fsec); }
Reproduced in: https: //www.cnblogs.com/zhao159357222/archive/2013/04/11/3014479.html