title: How can I lock a file in .net so that only my app can access it?
body: <p>I read queries regarding file locking but either they refer to multiple file access problem or something else.Ususal response to this would be lock to the file using FileStream.Lock,using FileShare.None with File.Open etc, but locking say a 100 files is not a good programming practice,also in these scenarios the lock will be released if my app closes/crashes which I don't want also  i.e. I want the lock to persist and only my app can open it for others.</p>
  
  <p>On msdn I found System.Security,System.Security.AccessControl namespaces,I believe these might help.Also <a href="https://stackoverflow.com/questions/1795492/how-to-provide-security-to-files-and-folders-through-c-net-in-fat-file-system">this</a> article will shed some light on what I want.</p>
  
  <p>EDIT::</p>
  
  <p>Mannnnn... did anyone referred the <strong>"this"</strong>  link I provided.</p>
  
  <p>Ok...in short I want something what PC Security software does.Does that ring a bell...anyone used it????</p>
  
  <p>Thanks.</p>