Game Development Reference
The root code group combines all permissions of its children.
policyLevel.RootCodeGroup = codeGroup;
Set the new policy level of the temporary AppDomain .
The following method is used to locate a named permission set within Windows.
In this example, we use it to locate the Local Intranet permission set.
private NamedPermissionSet FindNamedPermissionSet(string name)
IEnumerator policyEnumerator = SecurityManager.PolicyHierarchy();
PolicyLevel currentLevel = (PolicyLevel)policyEnumerator.Current;
if (currentLevel.Label == “Machine”)
IList namedPermissions = currentLevel.NamedPermissionSets;
IEnumerator namedPermission = namedPermissions.GetEnumerator();
if (((NamedPermissionSet)namedPermission.Current).Name == name)
The default settings for Local Intranet disable runtime compilation of source code within the tem-
porary AppDomain enforcing it. Runtime code compilation can open the door to malicious scripts,
so it is recommended that you only support this feature in a trusted environment.