Last post May 23, 2005 06:44 AM by cseary
Mar 10, 2005 05:49 PM|aarnott|LINK
May 20, 2005 11:47 AM|cseary|LINK
I've been working on the same issue for the last couple of days. Permission created from CodeAccessPermission, not implementing IUnrestricted so that permission is not granted with FullTrust.
Have got it to work fine with a Windows app, but need to alter web.config to achieve the desired result. This is fine when using the standard permissions (eg. FileIOPermission), but it does not seem to work properly with custom permissions.
Is there something else I need to do? Are there more settings in machine.config apart from the securityPolicy element that need altering?
May 23, 2005 06:44 AM|cseary|LINK
Found the answer!
I've recreated the custom permission, but allowed it to implement IUnrestricted. By default, all assemblies have Full Trust with the default Framework Configuration. This means that you don't have to apply permissions in the applet. If you are locking down
your security further using this applet, then you will have to add the permission to your permission set via importing xml. The xml can be obtained using the IPermission,ToXML().ToString().
To allow the ASP.NET application to use this permission, follow the instructions on:
Unfortunately, implementing IUnrestricted means that you can't apply this permission without FullTrust assemblies acquiring it, which means ultimately resorting to sandboxing due to not running the application under Full Trust. However, this is probably
best practice anyway.
Why doesn't it work without implemeting IUnrestricted? Dunno, but hopefully this will reduce time lost by others who are going down this route.