문제

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 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top