Impersonating in .NET using Process.Start and UAC

主宰稳场 提交于 2019-12-12 15:40:56

问题


I am trying to run programs from another .NET program that requires elevation using the impersonation option of the Process.Start (System.Diagnostics) method. The user for impersonation is a local administrator. The O/S is 2008 and UAC is turned on. Whenever calling process start I'm getting a Win32 permission error:

"The requested operation requires elevation"


回答1:


If the .NET application you are calling is configured properly in the app.manifest, you don't have to specify anything in the Process.Start call - the UAC will appear automatically.

app.manifest setting:

<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />



回答2:


Some information you might find helpful:

http://www.codeproject.com/KB/cs/zetaimpersonator.aspx

http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate%28VS.71%29.aspx



来源:https://stackoverflow.com/questions/3915370/impersonating-in-net-using-process-start-and-uac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!