0

I have a c# project, and I have to save some critical files in the Application directory in the C:\ then I need to use these files while my APP is running.

When I made the Setup project, I couldn't run my app unless I run it as administrator privilege. So how can I solve this problem I don't need each time of run a message like this appear.

any idea?

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Make the C drive available for users who are not administrators – Karthik AMR Oct 13 '14 at 07:23
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Oct 21 '14 at 17:55

1 Answers1

0

If your app needs admin privilege to run, then it will need elevation to admin privilege at some point. The normal way to do this is embed an elevation manifest, your build tool probably has (in the linker) a UAC setting for requireAdministrator. This is the way everything works - elevation to administrator privilege requires user consent, and elevation dialogs are normal when an app starts. The alternative is to save files in some other location that doesn't require admin privilege. If you need to do that saving of files rarely, then do it an another program that you start and it will ask for elevation, then your app isn't asking every time it runs.

I wouldn't make the C drive available to limited users - that allows access of limited users to everything.

PhilDW
  • 20,260
  • 1
  • 18
  • 28