Request UAC Elevation c#

给你一囗甜甜゛ 提交于 2019-12-01 09:13:37

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/7263918/request-uac-elevation-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!