2016-06-27 1 views
0

사용자에게 디렉토리의 파일을 편집 할 수 있도록 허용해야합니다. 디렉토리 및 파일은 관리자 권한으로 생성되었습니다. 따라서 사용자가 파일을 다시 저장하려고하면 예외가 발생합니다. 이 경우 내가 할 수있는 일은 무엇입니까? 또는 특정 권한을 가진 디렉토리를 만드는 방법이있을 수 있습니까? 나는 C#을 닷넷 4.0C# 관리 프로세스에서 파일 시스템 디렉터리 권한을 편집하십시오.

을 사용하고 이 같은 (하위 폴더 포함) 모든 사용자

답변

1

그랜드 액세스 :

DirectoryInfo dInfo; 
DirectorySecurity dSecurity = dInfo.GetAccessControl(); 
dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, AccessControlType.Allow)); 
dInfo.SetAccessControl(dSecurity); 
+0

큰 감사합니다! 잘 했어! – velgames