Modifying the CLR's security policy can be done in your code by interacting with the SecurityManager object. Specifically, you can access the PolicyHierarchy method which will expose an enumerator over the policy levels, and the SavePolicy method, which will commit your changes to the policy. However, using these methods can be counter-intuitive sometimes. Here's a sample method with a common problem in it -- if you can spot the defect, leave a comment, I'll provide answers tomorrow.
For some hints, the problem is not:
Here's the code: