title: How to deny Assert with CAS?
body: <p>In this code, I'd like the ReadFileSystem method to be forbidden to Assert a permission on the filesystem.</p>
  
  <p>I expected this will throw at fileIo.Assert(), but it doesn't. Why?</p>
  
  <pre><code>using System.Security.Permissions;
  static void Main(string[] args)
  {
      var fileIo = new FileIOPermission(PermissionState.Unrestricted);
      var secuPerm = new SecurityPermission(SecurityPermissionFlag.Assertion);
      PermissionSet set = new PermissionSet(PermissionState.Unrestricted);
      set.AddPermission(fileIo);
      set.AddPermission(secuPerm);
      set.Deny();
      ReadFileSystem();
      Console.Read();
  }
  
  private static void ReadFileSystem()
  {
      var fileIo = newFileIOPermission(PermissionState.Unrestricted);
      fileIo.Assert();
  
      DirectoryInfo dir = new DirectoryInfo("C:/");
      dir.GetDirectories();
  }
  </code></pre>
  
  <p><strong><em>Update</em></strong></p>
  
  <p>Great link here on CAS : <a href="http://blogs.msdn.com/shawnfa/archive/2004/08/25/220458.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/shawnfa/archive/2004/08/25/220458.aspx</a></p>