all groups > dotnet security > june 2006 >
You're in the

dotnet security

group:

Loading permission sets


Loading permission sets John Wood
6/26/2006 9:12:03 PM
dotnet security:
Hi all,

Is there any way to load a System.Security.PermissionSet with all the
permissions that are defined in the runtime security policy for a specific
zone? For example I want to set up an application to simulate running in a
browser, so I want it to be set up with all the permissions defined in the
Internet permission set that you see in the Runtime Security Policy editor.

Any ideas welcome.

John
---
Blog: http://www.dotnetjunkies.com/weblog/johnwood

Re: Loading permission sets Dominick Baier [DevelopMentor]
6/27/2006 12:00:00 AM
PermissionSet permissions;

evidence = new Evidence(
new object[] { new Zone(SecurityZone.Internet) },
new object[] { });

permissions = SecurityManager.ResolvePolicy(evidence);

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

[quoted text, click to view]

Re: Loading permission sets John Wood
6/27/2006 11:14:23 AM
Thanks Dominick.

Once I have the permission set, how would I go about denying all the
permissions that the Internet zone excludes? Performing a Deny on the
permission set you specify below doesn't seem to work for me... using the
overloaded ResolvePolicy that outputs the denied permissionset just raises
an exception 'Execution permission cannot be acquired' - not sure what I'm
doing wrong?

Thanks again.
John

"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
[quoted text, click to view]

AddThis Social Bookmark Button