问题
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