0
Reply

How to Deploy Security to a file

amuthapriya sundaram

amuthapriya sundaram

Aug 23 2010 7:41 AM
1.9k

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........................