.NET interview questions: - Explain CAS model is structured under .NET 4.0?
Under .NET 4.0 for CAS there are two major changes are brought in:-
• Permission granting is no more the work of CAS; it's now the work of the hosting model. In other words CAS is disabled in .NET 4.0 by default. The host will decide what rights to be given to the .NET assembly.
• A new security model i.e. Security transparent model is introduced. The security transparent model puts code in to separate compartments/ boxes as per the risk associated. If you know a code can do something wrong you can compartmentalizethe code as ‘Security transparent' and if you have a code which you trust you can box them in to ‘Security critical'.
Security transparent code is the code which you feel is unsafe and security safe critical code is the code which you feel is safe and has full access to the system.
Security transparent code cannot call critical code directly, if they have to then they need to go through security safe critical code.
Figure 2.5: - .NET 4.0 CAS model
Also see as detailed video on CAS which explains evidence, permission set & code groups as follows: -