SecurityException.Demanded Property

Definition

Gets or sets the demanded security permission, permission set, or permission set collection that failed.

[System.Runtime.InteropServices.ComVisible(false)]
public object Demanded { get; set; }
Property Value

A permission, permission set, or permission set collection object.

Examples

The following code example shows the use of the Demanded property to display the demanded security permission, permission set, or permission set collection that failed. This code example is part of a larger example provided for the SecurityException class.

Display("The demanded permission is: {0}",
    exception->Demanded);
Display("The demanded permission is: " + 
    sE.Demanded.ToString());
Display("The demanded permission is: " & sE.Demanded.ToString())

Remarks

In the case of a returned permission set or permission set collection, the returned object contains all the demanded permissions, one or more of which caused the failure.

Security

SecurityPermission
for the ability to manipulate the principal object. Associated enumerations: ControlEvidence, ControlPolicy Security action: Demand

Applies to