Code Security in .NET

The word itself describes that here we are going to briefly discuss about the security of code. As a technician we all know that security is the main point that strikes in our mind while performing tasks on our machine. When you talk about security you only think about the data security because data is the vital part for every IT company and you can save it by storing it in to a database so that none of the unethical minds can break through the security and get out our valuable information. But "have you ever think to secure your code?" the answer is NO. Like the data needs security similarly, the code also need to be secured. Now, let us discuss the security features that are provided by the .NET framework.

There are two types of security features provided by the .NET framework so that our code also secured from unauthorized users:

  • Role Based Security
  • Code Access Security

Role Based Security authorize the specific user to perform an action. It enables you to check that the available user is authenticated with in windows and also must be a part of a group with in a domain.

Code Access Security or CAS protects code from the unauthorized calls. Permission object can be used to prevent system resource access which specify the user and its role . CAS does not replace the role based security instead it augments the RB Security.

The main difference between the two is -

The RB security is implemented by you on your code and the CAS is implemented by the system itself.