C#.NET: Acquire administrator rights?

久未见 提交于 2019-11-26 16:03:06

问题


Is it possible in a C#.NET application to request administrative rights on a Windows 7 PC?

I want to be able to deploy the application via Click Once and have users use it to perform administrative tasks (in this case it is writing registry entries for the main application).


回答1:


http://victorhurdugaci.com/using-uac-with-c-part-1

http://victorhurdugaci.com/using-uac-with-c-part-2

http://victorhurdugaci.com/using-uac-with-c-part-3

*self promotion

Extra characters because it must be 30




回答2:


simply all what you need to do is to add manifest application file to your project

simple : right click on the project , add , new item , manifest file


and Change the

 <requestedExecutionLevel  level="asInvoker" uiAccess="false" />

to

 <requestedExecutionLevel level="highestAvailable" uiAccess="false" />


来源:https://stackoverflow.com/questions/3583501/c-net-acquire-administrator-rights

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