InteropPermission permission;
try
{
permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
// Get the CLR error before any other CLR operation
errorMessage = AifUtil::getClrErrorMessage();
CodeAccessPermission::revertAssert();
throw error(errorMessage);
}
or
Error: “Request for the permission of type ‘InteropPermission’ failed.”
Many times we would like to call method from dot net assemblies (or) com so we have to assign permission to execute the code .below are ways can be used for CLR and COM
Assign permissions to execute the code (CLR Interop). Like this:
InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);
;
permission.assert();
Assign permissions to execute the code (COM object). Like this::
InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
;
permission.assert();
try
{
permission = new InteropPermission(InteropKind::ClrInterop);
permission.assert();
CodeAccessPermission::revertAssert();
}
catch(Exception::CLRError)
{
// Get the CLR error before any other CLR operation
errorMessage = AifUtil::getClrErrorMessage();
CodeAccessPermission::revertAssert();
throw error(errorMessage);
}
or
Error: “Request for the permission of type ‘InteropPermission’ failed.”
Many times we would like to call method from dot net assemblies (or) com so we have to assign permission to execute the code .below are ways can be used for CLR and COM
Assign permissions to execute the code (CLR Interop). Like this:
InteropPermission permission = new InteropPermission(InteropKind::ClrInterop);
;
permission.assert();
Assign permissions to execute the code (COM object). Like this::
InteropPermission permission = new InteropPermission(InteropKind::ComInterop);
;
permission.assert();
No comments:
Post a Comment