SecurityException Constructor (String, AssemblyName, PermissionSet, PermissionSet, MethodInfo, SecurityAction, Object, IPermission, Evidence)

SecurityException Constructor (String, AssemblyName, PermissionSet, PermissionSet, MethodInfo, SecurityAction, Object, IPermission, Evidence)

Initializes a new instance of the SecurityException class for an exception caused by an insufficient grant set.

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

public SecurityException(
	string message,
	AssemblyName assemblyName,
	PermissionSet grant,
	PermissionSet refused,
	MethodInfo method,
	SecurityAction action,
	Object demanded,
	IPermission permThatFailed,
	Evidence evidence
)

Parameters

message
Type: System.String
The error message that explains the reason for the exception.
assemblyName
Type: System.Reflection.AssemblyName
An AssemblyName that specifies the name of the assembly that caused the exception.
grant
Type: System.Security.PermissionSet
A PermissionSet that represents the permissions granted the assembly.
refused
Type: System.Security.PermissionSet
A PermissionSet that represents the refused permission or permission set.
method
Type: System.Reflection.MethodInfo
A MethodInfo that represents the method that encountered the exception.
action
Type: System.Security.Permissions.SecurityAction
One of the SecurityAction values.
demanded
Type: System.Object
The demanded permission, permission set, or permission set collection.
permThatFailed
Type: System.Security.IPermission
An IPermission that represents the permission that failed.
evidence
Type: System.Security.Policy.Evidence
The Evidence for the assembly that caused the exception.

Use this constructor to throw an exception when the grant set caused the failure of the demand.

The following table shows the property values set by this constructor.

Property

Value

Message

The localized error message string specified by message.

FirstPermissionThatFailed

The first permission in the permission set or permission set collection specified by permThatFailed.

GrantedSet

The PermissionSet specified by grant.

Demanded

The demanded security permission, permission set, or permission set collection that failed, specified by demanded.

RefusedSet

The PermissionSet specified by refused.

DenySetInstance

An empty string.

PermitOnlySetInstance

An empty string.

FailedAssemblyInfo

The AssemblyName specified by assemblyName.

Method

The MethodInfo specified by method.

Zone

The SecurityZone value from the Evidence specified by evidence.

Url

The URL from the Evidence specified by evidence.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Community Additions

ADD
Show:
© 2016 Microsoft