Chapter 34. Code Access Security
Code access security (CAS) is one of those necessary technologies that is always there, but never noticed. We write code, compile it, run it, and know that the code works. If the code works properly, we don't often stop and think about the fact that code access security is being used in the background to ensure that managed code is never allowed to do more than it is allowed to do within the current enterprise, network, or computer.
Code access security defines a set of permissions that can be associated with managed code, as well as various ways of creating and querying those associations. It is the plumbing that prevents code downloaded from the Internet from making network requests to any location other than the host from which it was downloaded, and much, much more.
This chapter will introduce you to the key concepts surrounding CAS and give you the information you need so that you will be aware of the limitations imposed on your code by security, and how to write your code so that it takes security into account. You'll see the permissions and permission sets within which your code executes, and you'll see samples of how to create code that is security-aware and code that protects itself from being executed by unauthorized clients.
WHAT YOU NEED
CODE ACCESS SECURITY AT A GLANCE