开发者

Impersonating in .NET using Process.Start and UAC

开发者 https://www.devze.com 2023-01-19 12:35 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消