SecurityException Constructor (String^, Object^, Object^, MethodInfo^, Object^, IPermission^)
Initializes a new instance of the SecurityException class for an exception caused by a Deny on the stack.
Assembly: mscorlib (in mscorlib.dll)
public:
SecurityException(
String^ message,
Object^ deny,
Object^ permitOnly,
MethodInfo^ method,
Object^ demanded,
IPermission^ permThatFailed
)
Parameters
- message
-
Type:
System::String^
The error message that explains the reason for the exception.
- deny
-
Type:
System::Object^
The denied permission or permission set.
- permitOnly
-
Type:
System::Object^
The permit-only permission or permission set.
- method
-
Type:
System.Reflection::MethodInfo^
A MethodInfo that identifies the method that encountered the exception.
- demanded
-
Type:
System::Object^
The demanded permission, permission set, or permission set collection.
- permThatFailed
-
Type:
System.Security::IPermission^
An IPermission that identifies the permission that failed.
Use this constructor if a frame that contains a Deny caused the demand failure. 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. | |
An empty string. | |
The security permission, permission set, or permission set collection specified by demanded. | |
An empty string. | |
The denied security permission, permission set, or permission set collection specified by deny. | |
The permission, permission set, or permission set collection specified by permitOnly. | |
null. | |
The MethodInfo specified by method. | |
An empty string. |
The following code example shows the use of the SecurityException(String^, Object^, Object^, MethodInfo^, Object^, IPermission^) constructor.
// Demonstrate the SecurityException constructor // by throwing the exception again. Display("Rethrowing the exception thrown as a " "result of a PermitOnly security action."); throw gcnew SecurityException(exception->Message, exception->DenySetInstance, exception->PermitOnlySetInstance, exception->Method, exception->Demanded, exception->FirstPermissionThatFailed);
Available since 2.0