CAS Imperative Method

Method Level CAS (Code Access Security)

The Method Level Security comes with different Security Actions and those are below:
1. Demand Action
2. Link Demand Action
3. Inheritance Demand Action
4. Deny Action
5. PermitOnly Action
6. Assert Action

The text boxes (Markers 1 & 2) will display the value of the environment variables UserName and SecTest. The two read buttons (Markers 3 & 4) try to read those environment variables and sets the retrieved values in the corresponding text boxes 1 and 2.

The Radio button options (Marker 5) invoke the methods which had applied with the corresponding security attributes. We are going to debug the methods by picking an option here (marker 5) and hitting the Read buttons.

The check box (Marker 6) is used to explain how the security actions like Deny and Demand are invoked through imperative method. One can use the same imperative style for other security actions as well.