المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : What would make a CodeAccessPermission.Assert() fail or succeed?



C# Programming
06-26-2009, 04:22 PM
I'm trying to understand security in .NET.

FYI what I try to achieve is, I have the following files: MyApp.exe, MyLib.dll, Plugin.dll
I want to run everything in a low trust environment, so that only trusted source can execute. However I'd like to trust my MyLib.dll though.

As an exercise I have 2 app. App2 just start an AppDomain with lower permission set and execute App1 in it.
In App1, for the sake of the exercise, I am calling SomePermission.Assert().

This fail with a security exception. Fine, I like that. Now I strongly signed my assembly App1 and it still fails on the Assert() call with SecuritException.

mmh... how do I circumvent that?
I know that some DLL are able to do thing that the caller is not allowed to do, how do they escalate their right? why the caller cannot?

A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.