title: How to give permissions for folders in c#?
body: <p>I need to give the folder &quot;Temporary ASP.NET Files&quot; a write permission using c#... and I use this code to give it the access</p>
  <pre><code>DirectoryInfo d1 = new DirectoryInfo(Path.Combine(RuntimeEnvironment.GetRuntimeDirectory(), &quot;Temporary ASP.NET Files&quot;));
  DirectorySecurity md1 = d1.GetAccessControl();
  
  
  string user_1 = fa.TextGuestDomain + &quot;\\&quot; + fa.TextGuestUser;
  md1.AddAccessRule(new FileSystemAccessRule(user_1, FileSystemRights.FullControl,InheritanceFlags.ObjectInherit,PropagationFlags.InheritOnly, AccessControlType.Allow));
  
  d1.SetAccessControl(md1);
  </code></pre>
  <p>When I checked for the security properties for the folder &quot;Temporary ASP.NET Files&quot; after implementing the code, it didn't checked the &quot;write&quot; permission check-box, instead of that it checked the &quot;special permissions&quot; one... I have noticed that even when I changed the access from write to full control or read , it checked the &quot;special permissions&quot; one....</p>
  <p>This is not the problem :), the problem is its not giving the right access that i give to it... when I give it write, it doesn't act like if I give it the write permission. I don't know why !! Am I doing it the wrong way ??</p>
  <p>Note:
  when I'm doing it in the manual way its working, while when using the coding way. it's not working...</p>
  <p>I hope you can help me with that...</p>
  <p>Thanks alot</p>