Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 rights from the beginning is not appropriate as it may be that such action may not be called.

like image 789
sashaeve Avatar asked May 06 '10 10:05

sashaeve


2 Answers

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.

like image 106
Hans Olsson Avatar answered Sep 29 '22 09:09

Hans Olsson


Ask username/password and impersonate the admin user.

like image 29
Muhammad Hasan Khan Avatar answered Sep 29 '22 11:09

Muhammad Hasan Khan