Changing Security Policy by Programming Directly to the Security APIs
Instead of using a particular tool to alter or view security policy, you can also use the Security classes that ship with the .NET Framework base class library to view or change policy directly. In fact, both the Caspol tool as well as the .NET Framework Configuration tool have been implemented using these classes. To solve everyday administrative tasks, it will be very unlikely that you need to make use of these APIs, but the following are some situations in which access to these classes will be necessary:
You want to write your own policy administration tool.
You want to write a policy analysis tool that checks for policy invariants particular to your business or home situation. ...