2 using System.Reflection;
4 using System.Security.Permissions;
9 // this ensure we don't have FullTrust
10 [assembly: SecurityPermission (SecurityAction.RequestRefuse, SkipVerification = true)]
13 public class Program {
15 static bool IsRestricted ()
27 // aptclib.dll is strongnamed and DOESN'T have [AllowPartiallyTrustedCallers]
28 // so this call will work ONLY IF this assembly IS strongnamed
29 string s = AptcLibrary.Hello ("World");
30 int ec = IsRestricted () ? 1 : 0;
31 Console.WriteLine ("*{0}* AptcLibrary: {1}", ec, s);
34 catch (SecurityException se) {
35 int ec = IsRestricted () ? 0 : 1;
36 Console.WriteLine ("*{0}* Expected SecurityException\n{1}", ec, se);
40 Console.WriteLine ("*2* Unexpected exception\n{0}", e);