Manufacture and print an example policy : PolicyStatement « Security « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.IO;
using System.IO.IsolatedStorage;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security;
using System.Security.AccessControl;
using System.Security.Policy;
using System.Security.Permissions;
using System.Security.Principal;
using System.Text;

public class MainClass
{
    public static void Main()
    {
        PolicyStatement policy = new PolicyStatement(new PermissionSet(PermissionState.Unrestricted), new PolicyStatementAttribute());
        UnionCodeGroup group = new UnionCodeGroup(new ZoneMembershipCondition(SecurityZone.Internet), policy);
        group.Name = "java2s";

        UnionCodeGroup childGroup = new UnionCodeGroup(new UrlMembershipCondition("http://www.java2s.com/"), policy);
        group.AddChild(childGroup);

        Console.WriteLine(group.ToXml().ToString());
    }
}















35.6.PolicyStatement
35.6.1.Manufacture and print an example policy