c# removing users from security tab
<p>I am removing removing permissions from a folder to given users i want to be able to remove the user from the folder security tab list</p>

<p>excerpt code </p>

<pre><code>myDirectorySecurity.RemoveAccessRule(new FileSystemAccessRule(User, FileSystemRights.Write | FileSystemRights.Read, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
     PropagationFlags.None, AccessControlType.Allow));

                myDirectoryInfo.SetAccessControl(myDirectorySecurity);
</code></pre>

<p>i want to remove the user after permission is remove.. </p>

<p><img src="http://i93.photobucket.com/albums/l66/reavenm/Capture_zps51403cae.png" alt="picture"></p>

<p>i tried to add that to my code here</p>

<pre><code>DataSet dataSet = new DataSet(); 
string sql = "SELECT key, fdate, user, perm, sfolder FROM  permuser WHERE        fdate=CURDATE()";

MySqlConnection connection = new MySqlConnection(MyConString);
MySqlCommand cmdSel = new MySqlCommand(sql, connection);
new MySqlDataAdapter(cmdSel).Fill(dataSet, "permuser");


foreach (DataRow row in dataSet.Tables["permuser"].Rows)
    {
         string fuser = row["user"].ToString();
         string pathtxt = row["sfolder"].ToString();

        DirectoryInfo myDirectoryInfo = new DirectoryInfo(pathtxt);
        DirectorySecurity myDirectorySecurity = myDirectoryInfo.GetAccessControl();
        string User = System.Environment.UserDomainName + "\\" + fuser;


                myDirectorySecurity.RemoveAccessRule(new FileSystemAccessRule(User, FileSystemRights.Write | FileSystemRights.Read, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit,
     PropagationFlags.None, AccessControlType.Allow));

                myDirectoryInfo.SetAccessControl(myDirectorySecurity);
                   //it should go here
    }

connection.Close();
connection.Dispose();
}


catch (MySqlException ex)
{
Console.WriteLine(ex.Message);
Environment.Exit(0);
}
</code></pre>
