开发者

How elevate and get admin rights on-demand in a .NET application?

I have an .NET application which is run with default rights as the current user, then at some point I need to perform an action which requires admin rights.

How can I get admin rights on-demand in a .NET application?

Requiring that the application is run with admin 开发者_JS百科rights from the beginning is not appropriate as it may be that such action may not be called.


I don't think this is possible. One way to get around it would be to split your application in two, one for all the operations that doesn't need elevation and one for the ones that do. Then you run the non elevated app as normal but start up the elevated one when needed.


Ask username/password and impersonate the admin user.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜