title: Checking for shared folder write access for current user
body: <p>I have following method to check current user have write access to given network location </p>
  
  <pre><code>DirectorySecurity shareSecurity = new DirectoryInfo(this.GetFileServerRootPath).GetAccessControl();
  
  foreach (FileSystemAccessRule fsRule in shareSecurity.GetAccessRules(true, true, typeof(NTAccount)))
  {
      // check write permission for current user
      if (AccessControlType.Allow == fsRule.AccessControlType &amp;&amp;
              FileSystemRights.Write == (fsRule.FileSystemRights &amp; FileSystemRights.Write))
      {
          if (null != fsRule.IdentityReference &amp;&amp;
              fsRule.IdentityReference.Value == WindowsIdentity.GetCurrent().Name)
          {
              return true;
          }
      }
  }
  return false;
  </code></pre>
  
  <p>but problem is when folder permission given to user group, above method is failed. </p>
  
  <p><strong>I don't want to check the permissions by writing a file and decide the write access permissions.</strong> </p>
  
  <p>is there any way to find current user in the <code>IdentityReference.Value</code>? or suggestions to overcome this issue? </p>