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.
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 |
|---|---|
The localized error message string specified by message. | |
The first permission in the permission set or permission set collection specified by permThatFailed. | |
The PermissionSet specified by grant. | |
The demanded security permission, permission set, or permission set collection that failed, specified by demanded. | |
The PermissionSet specified by refused. | |
An empty string. | |
An empty string. | |
The AssemblyName specified by assemblyName. | |
The MethodInfo specified by method. | |
The SecurityZone value from the Evidence specified by evidence. | |
The URL from the Evidence specified by evidence. |
For an example of the use of a SecurityException constructor, see the example provided for the SecurityException(String, Object, Object, MethodInfo, Object, IPermission) constructor.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.