why File System GetAuditRules() returns null
Hi Folks,
I am trying to get information about File Auditing using ASP.NET.
I am trying to get that information on website but it doesn't work and return null
collection of FileSystemAuditRule. But when I try to use GetFileAccessRules() method. It
works fine and return valid collection. This is sure file has an audit active. and it should
return one record at least.
Why GetFileAccessRules() works and GetFileAuditRules() doesn't work. Is there any difference
between them while using?
If I am using wrong way to get file audit information then please let me know what is the
best way to check file auditing?
Please help me because due to this I am stuck. I would really appreciate your assistance.
I am using the following code to get file audit information.
string FileName = Server.MapPath("test.txt");
FileSecurity fSecurity = File.GetAccessControl(FileName);
foreach (FileSystemAuditRule ace in fSecurity.GetAuditRules(true, true, typeof(NTAccount)))
{
Console.WriteLine("\tIdentityReference.Value: " + ace.IdentityReference.Value);
Console.WriteLine("\tAuditFlags: " + ace.AuditFlags);
Console.WriteLine("\tRegistryRights: " + ace.RegistryRights.ToString());
Console.WriteLine("\tInheritanceFlags: " + ace.InheritanceFlags);
Console.WriteLine("\tIsInherited: " + ace.IsInherited);
Console.WriteLine("\tPropagationFlags: " + ace.PropagationFlags);
Console.WriteLine("-----------------\r\n\r\n");
}
Waiting for your prompt and helpful reply with thanks in anticipation
G. Mustafa
|