How to Deploy Security to a file

Aug 23 2010 7:41 AM

hi,
 I would like to give the permission to a file.here is my code is as follows.
 
  string filename="F:\\memory_reduce.txt";
FileSecurity fs =File.GetAccessControl(filename);
fs.AddAccessRule(
new FileSystemAccessRule(@"DomainNme\\AccountName", FileSystemRights.FullControl, AccessControlType.Allow));
File.SetAccessControl(filename,fs);
 
but it's not working.
 
"some or all identity references could not be translated ". exception comes.
can someone help me? pls........................