以“以管理员身份"运行C#方法. [英] Run C# method "as administrator"

查看:165
本文介绍了以“以管理员身份"运行C#方法.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一种只能在管理员模式"下工作的方法.如何使UAC对话框出现,以便方法/功能在管理员模式"下运行?

解决方案

在需要管理员执行级别的应用程序中,而其余部分则不需要. Microsoft推荐的指南表明,您应该将管理级别的方法隔离到单独的EXE中,并包括一个嵌入式清单,声明要求管理员级别.请参阅应用程序兼容性手册的用户帐户控制(UAC)部分,位于: 解决方案

It sounds like you have a method in your application that needs administrator execution level, but the rest of the application does not. The recommended guidance from Microsoft indicates that you should isolate the administration-level method into a separate EXE and include an embedded manifest declaring that administrator level is requested. See the User Account Control (UAC) section of the Application Compatibility Cookbook at: http://msdn.microsoft.com/windowsvista/letter/default.aspx?pull=/library/en-us/dnlong/html/AppComp.asp#appcomp_topic4

The following thread has an example manifest file that shows how to add in the request for administrator level:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=769187&SiteID=1


这篇关于以“以管理员身份"运行C#方法.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆