using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Security.Permissions;
using System.Security.Principal;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Exam2
{
    class Program
    {
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
            try
            {
                ShowMessage();
            }
            catch (SecurityException exception)
            {
                Console.WriteLine("Security exception caught ({0})", exception.Message);
                Console.WriteLine("The current principal must be in the local"
                                  + "Users group");
            }

            Console.Read();
        }
        //[PrincipalPermission(SecurityAction.Demand, Role = "BUILTIN\\Users")]
        [PrincipalPermission(SecurityAction.Demand, Role = "BUILTIN\\Guest")]
        static void ShowMessage()
        {
            Console.WriteLine("The current principal is logged in locally ");
            Console.WriteLine("(member of the local Users group)");
        }
    }
}

最新文章

  1. 【2016-10-16】【坚持学习】【Day7】【建造者模式】
  2. MVC中使用EF的技巧集
  3. AngularJS之directive
  4. Gated Recurrent Unit (GRU)公式简介
  5. iTunes访问自己应用的沙盒
  6. jdbc调用sparksql
  7. 实际例子描述和分析“猎豹抢票跨站推荐功能有票刷不到”的疑似bug
  8. netstat详解
  9. WebSocket协议
  10. UEFI模式下安装Win 7系统
  11. Android 6.0 以及HttpClient
  12. maven 编
  13. Telegram学习解析系列(二):这我怎么给后台传输数据?
  14. [ZJOI2007] 捉迷藏
  15. 题解:YNOI/GZOI2019 与或和
  16. sqlite3如何判断一个表是否已经存在于数据库中 C++
  17. 一条sql解决.一张表的数据复制到另外一张表
  18. mui 页面提示:Unable to preventDefault inside passive
  19. mysql 语句 GROUP_CONCAT
  20. 基于FPGA摄像头图像采集显示系统

热门文章

  1. Android 升级到Android Studio2.2 后打不开以前版本的项目
  2. php输出文件,数组
  3. xp2p系统的10点技术创新和经验总结
  4. 一步步学习Linux多任务编程
  5. oracle改动登录认证方式
  6. Linux下iptables屏蔽IP和端口号
  7. [Angular] Export directive functionalities by using 'exportAs'
  8. 【codeforces 546B】Soldier and Badges
  9. NOIP模拟 poke - 贪心
  10. WPF入门(三)->几何图形之线条(LineGeometry)