首页 > Windows开发 > 详细

C#:判断当前程序是否通过管理员运行

时间:2014-11-09 13:55:49      阅读:214      评论:0      收藏:0      [点我收藏+]
原文:C#:判断当前程序是否通过管理员运行

public bool IsAdministrator()
{
WindowsIdentity current = WindowsIdentity.GetCurrent();
WindowsPrincipal windowsPrincipal = new WindowsPrincipal(current);
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
}

 

 

 

 

转载声明:本文转载至http://www.zhoumy.cn/?p=9

C#:判断当前程序是否通过管理员运行

原文:http://www.cnblogs.com/lonelyxmas/p/4084988.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!