A) Implement declarative security and execute the permission demand to allow access to the file system and Windows registry. | B) Implement declarative security and execute the minimum permission request to allow access to the file system and Windows registry. |
C) Implement imperative security and execute the permission demand to allow access to the file system and Windows registry. | D) Implement imperative security and execute the minimum permission request to allow access to the file system and Windows registry. |
Explanation:
You can use declarative code access security to request permissions for the entire assembly. SecurityAction flags that can be specified in an assembly-wide directive. When SecurityAction.RequestMinimum is specified, it makes a request to the common language runtime to be granted the requested permission. If the requested permission is not granted by the security policy, the assembly will not execute. A Security Action.RequestOptional is similar, but the assembly will still run even if the requested permission is not granted. Specifying security Action. RequestRefuse requests that the assembly be denied the specified permission.
You must use the Assembly (assembly) directive when specifying these actions as follows:
Option A:
There are only three Security actionAttributes targets for an assembly: RequestMinimumAssembly, RequestOptionalAssembly, and RequestRefuseAssembly.
Option C, D:
Imperative security does not work well to configure security for an entire assembly. In imperative security, permission to execute is demanded at run time.