using System;
using System.Security;
using System.Security.Principal;
using System.Security.Permissions;
class Program {
staticvoid Main(string[] args) {
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
try {
ShowMessage();
} catch (SecurityException exception) {
Console.WriteLine(exception.Message);
}
}
[PrincipalPermissionAttribute(SecurityAction.Demand,Role = "BUILTIN\\Users")]
staticvoid ShowMessage() {
Console.WriteLine("The current principal is logged in locally ");
Console.WriteLine("(they are a member of the local Users group)");
}
}