Edit

Share via


SecurityException.Demanded Property

Definition

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

public:
 property System::Object ^ Demanded { System::Object ^ get(); void set(System::Object ^ value); };
public object? Demanded { get; set; }
public object Demanded { get; set; }
[System.Runtime.InteropServices.ComVisible(false)]
public object Demanded { get; set; }
member this.Demanded : obj with get, set
[<System.Runtime.InteropServices.ComVisible(false)>]
member this.Demanded : obj with get, set
Public Property Demanded As Object

Property Value

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

Attributes

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.

Applies to