1

Possible Duplicate:
setting UAC settings of a file in C#

I want to set file permissions so only those with administrative privileges can change it.

Can anyone give me a good example on how to do this in c#?

UPDATE

I've tried various things with FileSecurity, and I simply can't get a hang of it.

Here are the permissions that I'd like to impose on file:

enter image description here

Community
  • 1
  • 1
Arsen Zahray
  • 24,367
  • 48
  • 131
  • 224
  • Please see "[Stack Overflow does not allow tags in titles](http://meta.stackexchange.com/a/130208)". – John Saunders Jun 19 '12 at 18:49
  • 2
    excuse me? what's wrong with the post? I don't see a good answer here on how to set administrator access permissions on a file using FileSecurity. This is not a duplicate – Arsen Zahray Jun 19 '12 at 18:52

1 Answers1

1

Administrators can access anything (doesn't matter privileges, so the problem will be other users. The fourth argument of System.Io.File.Create. is an System.Security.AccessControl.FileSecurity object. That's what you need.

Erre Efe
  • 15,387
  • 10
  • 45
  • 77