Click here to Skip to main content
15,894,460 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello there,
at the moment I am creating an application for desktopcomputers in offices. A user shall be abled to create tasks with the application on a specific server. But no user should have adminrights on the server. So I will create a adminuser on the server which I want to run the programm with.
So how can I set a user the program will run with?

My english isnt that good yet, I apologize.
Posted

If you want to run task with admini privileges, see these:
http://stackoverflow.com/questions/2021831/admin-rights-for-a-single-method[^]
http://stackoverflow.com/questions/4106628/start-process-with-administrator-right-in-c-sharp[^]

C#
Process p = new Process("FullPathToSchedulerOnServer.exe");
p.StartInfo.UserName = "ServerAdmin";
p.StartInfo.Password = "SAPassword";
p.Start();


[EDIT #1]
See these:
http://stackoverflow.com/questions/3003417/how-do-i-use-impersonation-on-a-c-sharp-winforms-application-to-run-with-admin-p[^]
User Impersonation in .NET[^]?

[/EDIT]
 
Share this answer
 
v3
Comments
ANDiyo 16-Apr-13 4:23am    
Is there no way to set a user with password in beginning with which the whole application will run?
Maciej Los 16-Apr-13 5:18am    
See my answer after update ;)
Hi there,

Not sure about it, but you might try this link for further information:
http://superuser.com/questions/145575/automatically-run-an-application-as-another-user[^]
 
Share this answer
 
Comments
ANDiyo 16-Apr-13 3:49am    
Do you know if can write the password in the shortcut?

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