Demanded Property

SecurityException.Demanded Property

 

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

Namespace:   System.Security
Assembly:  mscorlib (in mscorlib.dll)

[ComVisibleAttribute(false)]
public object Demanded {
	[SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.NoFlags | SecurityPermissionFlag.ControlEvidence | SecurityPermissionFlag.ControlPolicy)]
	get;
	set;
}

Property Value

Type: System.Object

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

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.

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: " + 
    sE.Demanded.ToString());

SecurityPermission

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft