Impersonating in .NET using Process.Start and UAC
I开发者_如何学Go 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"
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" />
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
精彩评论