Two Approaches to User-Based Security

There are two major approaches to working with user-based security in .NET. The first way is known as the imperative approach, which involves explicit decision making in code. The second way is known as the declarative approach, which involves the use of attributes.

There are actually two slightly different styles that can be used in the imperative approach. The old-style imperative approach is basically the same as that used in conventional Win32 security programming, where you determine who the user is and explicitly choose the execution path using an if statement. Typically, the decision is made between two execution branches, where one is successful and the other throws a SecurityException. Although this ...

Get .NET Security and Cryptography now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.