以特定用户身份运行C#应用程序 [英] Run a C# Application as specific user
问题描述
你好,
我正在为办公室中的桌面计算机创建一个应用程序。用户应能够在特定服务器上使用该应用程序创建任务。但是没有用户应该在服务器上拥有管理员。所以我将在服务器上创建一个管理员,我想运行该程序。
那么如何设置程序运行的用户?
我的英语还不错,我道歉。
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.
推荐答案
你好,
不确定,但您可以尝试使用此链接获取更多信息:
http://superuser.com/questions/145575/automatically-run-an-application-as-another-user [ ^ ]
如果你想使用admini权限运行任务,请参阅以下内容:
http:/ /stackoverflow.com/questions/2021831/admin-rights-for-a-single-method [ ^ ]
http://stackoverflow.com/questions/4106628/start-process-with-administrator-right- in-c-sharp [ ^ ]
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[^]
Process p = new Process("FullPathToSchedulerOnServer.exe");
p.StartInfo.UserName = "ServerAdmin";
p.StartInfo.Password = "SAPassword";
p.Start();
见这些:
http://stackoverflow.com/questions/3003417/how-do-i-use-impersonation-on-ac-sharp-winforms-application-to-run-with-admin-p [ ^ ]
.NET中的用户模拟 [ ^ ]?
[/ EDIT]
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]
这篇关于以特定用户身份运行C#应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!