M
Matt Theule
How do I programatically add a code group to a particular version of
the dotNet framework, or better yet, ALL versions fo the framework?
Using the code below, I can add a CodeGroup to the machine policy of a
computer to fully trust all assemblies from a particular website.
The problem arises in that I use VS 2002 to run the code below and I
have FW v1.0 *AND* FW v1.1 installed on my workstation. When the code
below runs, the code group is visible in the Configuration tool that
installed with FW 1.0. It is *NOT* visible in the Configuration 1.1
tool.
The aspx application that needs to access the assemblies that are
refrenced in the new code group is using FW 1.1, so the application
fails to run. If manually add the code group to the Configuration 1.1
tool, the application runs.
How can I register a code group with *ALL* the installed versions of
dotNet framework?
Thanks
public void AddCodeGroup{
PolicyLevel machinePolicyLevel = null;
System.Collections.IEnumerator ph = SecurityManager.PolicyHierarchy();
while( ph.MoveNext() )
{
PolicyLevel pl = (PolicyLevel)ph.Current;
if( pl.Label == "Machine" )
{
machinePolicyLevel = pl;
break;
}
}
PermissionSet permSet1 = new NamedPermissionSet("FullTrust");
IMembershipCondition membership1 =
new UrlMembershipCondition("http://scc---wsmattt02/*");
PolicyStatement policy1 = new PolicyStatement(permSet1);
CodeGroup codeGroup1 = new UnionCodeGroup(membership1, policy1);
codeGroup1.Name = "FullyTrustedCodeGroup";
machinePolicyLevel.RootCodeGroup.AddChild(codeGroup1);
SecurityManager.SavePolicy();
}
the dotNet framework, or better yet, ALL versions fo the framework?
Using the code below, I can add a CodeGroup to the machine policy of a
computer to fully trust all assemblies from a particular website.
The problem arises in that I use VS 2002 to run the code below and I
have FW v1.0 *AND* FW v1.1 installed on my workstation. When the code
below runs, the code group is visible in the Configuration tool that
installed with FW 1.0. It is *NOT* visible in the Configuration 1.1
tool.
The aspx application that needs to access the assemblies that are
refrenced in the new code group is using FW 1.1, so the application
fails to run. If manually add the code group to the Configuration 1.1
tool, the application runs.
How can I register a code group with *ALL* the installed versions of
dotNet framework?
Thanks
public void AddCodeGroup{
PolicyLevel machinePolicyLevel = null;
System.Collections.IEnumerator ph = SecurityManager.PolicyHierarchy();
while( ph.MoveNext() )
{
PolicyLevel pl = (PolicyLevel)ph.Current;
if( pl.Label == "Machine" )
{
machinePolicyLevel = pl;
break;
}
}
PermissionSet permSet1 = new NamedPermissionSet("FullTrust");
IMembershipCondition membership1 =
new UrlMembershipCondition("http://scc---wsmattt02/*");
PolicyStatement policy1 = new PolicyStatement(permSet1);
CodeGroup codeGroup1 = new UnionCodeGroup(membership1, policy1);
codeGroup1.Name = "FullyTrustedCodeGroup";
machinePolicyLevel.RootCodeGroup.AddChild(codeGroup1);
SecurityManager.SavePolicy();
}