开发者

Request UAC Elevation c#

开发者 https://www.devze.com 2023-03-31 22:52 出处:网络
Hi when i try to open my app in win-xp it works fine but when i try it on win7 it says access to path (path location) is denied unless i open it as administrator so 开发者_运维技巧how can i give my ap

Hi when i try to open my app in win-xp it works fine but when i try it on win7 it says access to path (path location) is denied unless i open it as administrator so 开发者_运维技巧how can i give my app administrator rights without promoting

Thank you


You can't gain administrator rights on a system with UAC without passing through UAC elevation.

Your options are:

  1. Manifest your app so that it always runs as administrator. The user sees the UAC dialog every time they start the app.
  2. Separate the part of the app that needs admin rights into a separate process and just require elevation for that part.
  3. Re-work your app so that it doesn't need admin rights.

Of these options you should prefer 3. If you can't achieve that then 2 is better than 1.

0

精彩评论

暂无评论...
验证码 换一张
取 消