You are creating a new security policy for an application domain. You write the following lines of code.

You are creating a new security policy for an application domain. You write the following lines of
code.

Dim objPolicy As PolicyLevel = PolicyLevel.CreateAppDomainLevelDim
noTrustStatement As New PolicyStatement( _
objPolicy.GetNamedPermissionSet("Nothing"))
Dim fullTrustStatement As New PolicyStatement( _
objPolicy.GetNamedPermissionSet("FullTrust"))
You need to arrange code groups for the policy so that loaded assemblies default to the Nothing
permission set. If the assembly originates from a trusted zone, the security policy must grant the
assembly the FullTrust permission set. Which code segment should you use?


A. Dim objGroup1 As CodeGroup = New FirstMatchCodeGroup( _
    New ZoneMembershipCondition(SecurityZone.Trusted), _
    fullTrustStatement)Dim objGroup2 As CodeGroup = New UnionCodeGroup( _
    New AllMembershipCondition, noTrustStatement)

B. Dim objGroup1 As CodeGroup = New FirstMatchCodeGroup( _
    New AllMembershipCondition, noTrustStatement)Dim objGroup2 As CodeGroup =
    New UnionCodeGroup( _
    New ZoneMembershipCondition(SecurityZone.Trusted), _
    fullTrustStatement)

C. Dim objGroup As CodeGroup = New UnionCodeGroup( _
    New ZoneMembershipCondition(SecurityZone.Trusted), _
    fullTrustStatement)

D. Dim objGroup As CodeGroup = New FirstMatchCodeGroup( _
    New ZoneMembershipCondition(SecurityZone.Trusted), _
    fullTrustStatement)

Answer: B 

No comments:

Post a Comment