Click here to Skip to main content
15,885,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to make a login that will do like Run AS on a apps would do so that it will use the username password set at start by the user so that i can use System.ServiceProcess ServiceController() to stop and start services on a windows server.

I have found lots of ways to do make a login form but non that act has run as would, where the user name and password of the applications are not the one from the user loged in windows but the one that is logged has.

(ps. just got back after ten years Oracle DBA so please be gentle)

Any help or links showing some examples.
Posted

1 solution

Not sure if I understand your question correctly, but after asking the user name and password, you can start a new process with the given user account. You just need to use the ProcessStartInfo[^] to define the user name and the password.

I used a similar technique in Directory size browser[^]. Have a look at the code in "Option 2: Elevate privileges during the application startup".

Again, sorry if I misunderstood the situation.
 
Share this answer
 
Comments
Maciej Los 8-Sep-15 12:23pm    
Gooda advice!
Wendelius 8-Sep-15 13:20pm    
Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900