This chapter has provided you with coverage of one of the core pieces of the .NET Framework: Code Access Security. CAS provides a mechanism for restricting access to protected and potentially dangerous resources like system files, regular files, network sockets, web sites, registry settings, and much more. CAS works intelligently to prevent the situation where an untrusted caller can exploit a fully trusted assembly to create a security hole. Although it is difficult to create this scenario, you can leave yourself open to attack and exploitation through the misuse of permission assertions and allowing partially trusted callers. Through the use of both imperative and declarative coding with CAS in mind, you can create secure applications that can access the resources they need while preventing malicious code from exploiting that same access.