Click here to Skip to main content
16,007,163 members
Home / Discussions / C#
   

C#

 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart2-Mar-04 12:19
protectorHeath Stewart2-Mar-04 12:19 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton2-Mar-04 13:58
Throckmorton2-Mar-04 13:58 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton2-Mar-04 17:23
Throckmorton2-Mar-04 17:23 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 3:27
protectorHeath Stewart3-Mar-04 3:27 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton3-Mar-04 9:19
Throckmorton3-Mar-04 9:19 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 9:27
protectorHeath Stewart3-Mar-04 9:27 
GeneralRe: HELP with Code Access Security! Pin
Throckmorton3-Mar-04 10:11
Throckmorton3-Mar-04 10:11 
GeneralRe: HELP with Code Access Security! Pin
Heath Stewart3-Mar-04 10:16
protectorHeath Stewart3-Mar-04 10:16 
Compare it with this...which works:
// Create the policy statement.
NamedPermissionSet namedPS = new NamedPermissionSet("FullTrust");
PolicyStatement ps = new PolicyStatement(namedPS);
ps.Attributes = PolicyStatementAttribute.Exclusive;
 
// Create the membership condition.
string url = "http://www.dummycorp.com";
UrlMembershipCondition condition = new UrlMembershipCondition(url);
 
// Create the code group.
UnionCodeGroup proplanner = new UnionCodeGroup(condition, ps);
proplanner.Name = "MyCodeGroup";
proplanner.Description = "Allows fully-trusted access to the URL.";
 
// Find the machine policy level.
PolicyLevel machine = null;
IEnumerator ie = SecurityManager.PolicyHierarchy();
while (ie.MoveNext())
  if (String.Compare(((PolicyLevel)ie.Current).Label, "Machine", true) == 0)
    machine = (PolicyLevel)ie.Current;
 
// If the machine policy level was not found, throw an exception.
if (machine == null)
  throw new InstallException("Unable to find the Machine policy level.");
 
// Enumerate the root code group children and
// determine if the Proplanner group already exists.
bool exists = false;
foreach (CodeGroup group in machine.RootCodeGroup.Children)
{
  if (proplanner.Equals(group))
  {
    exists = true;
    break;
  }
}
 
// If the code group doesn't exist, add it.
if (!exists)
{
  // Add our code group to the root code group.
  machine.RootCodeGroup.AddChild(proplanner);
  SecurityManager.SavePolicyLevel(machine);
}


 

Microsoft MVP, Visual C#
My Articles
Generalproblems in running app at win startup Pin
visiontec2-Mar-04 10:22
visiontec2-Mar-04 10:22 
GeneralRe: problems in running app at win startup Pin
Dave Kreskowiak2-Mar-04 11:12
mveDave Kreskowiak2-Mar-04 11:12 
GeneralClient size of an control ... Pin
Andres Coder2-Mar-04 7:49
Andres Coder2-Mar-04 7:49 
GeneralRe: Client size of an control ... Pin
Heath Stewart2-Mar-04 9:24
protectorHeath Stewart2-Mar-04 9:24 
Generalinternet explorer Pin
cmarmr2-Mar-04 7:27
cmarmr2-Mar-04 7:27 
GeneralRe: internet explorer Pin
Heath Stewart2-Mar-04 9:39
protectorHeath Stewart2-Mar-04 9:39 
GeneralRe: internet explorer Pin
cmarmr2-Mar-04 9:55
cmarmr2-Mar-04 9:55 
GeneralRe: internet explorer Pin
Heath Stewart2-Mar-04 10:00
protectorHeath Stewart2-Mar-04 10:00 
GeneralRemoting: sharing an object Pin
Judah Gabriel Himango2-Mar-04 7:24
sponsorJudah Gabriel Himango2-Mar-04 7:24 
GeneralRe: Remoting: sharing an object Pin
Heath Stewart2-Mar-04 9:21
protectorHeath Stewart2-Mar-04 9:21 
QuestionHow To: Wizard for my Application Pin
Ritesh Sompura2-Mar-04 7:01
Ritesh Sompura2-Mar-04 7:01 
AnswerRe: How To: Wizard for my Application Pin
Heath Stewart2-Mar-04 9:16
protectorHeath Stewart2-Mar-04 9:16 
AnswerRe: How To: Wizard for my Application Pin
Nick Parker2-Mar-04 9:27
protectorNick Parker2-Mar-04 9:27 
GeneralAnimation Pin
hxxbin2-Mar-04 6:55
hxxbin2-Mar-04 6:55 
GeneralRe: Animation Pin
Heath Stewart2-Mar-04 9:13
protectorHeath Stewart2-Mar-04 9:13 
GeneralRe: Animation Pin
hxxbin3-Mar-04 4:03
hxxbin3-Mar-04 4:03 
GeneralRe: Animation Pin
Heath Stewart3-Mar-04 5:55
protectorHeath Stewart3-Mar-04 5:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.