Hi,
Is it possible to call a fully trusted code that performs actions that the
partially trusted appDomain running code is not allowed to run?
Here is my scenario:
1. create an appDomain which is restricted from writing to a specific file.
2. I want this appDomain to call another assembly (my assembly) that will
perform the file writing for the partially trusted appDomain.
Although my assembly has full trust on the machine I still get a security
exception when trying to write to the file...
Is there any way of making this scenario work???
Thanks
Shai
Joe Kaplan - 11 Nov 2007 16:00 GMT
Yes, it is possible to do this (although it does imply a security risk).
The main thing is that the fully trusted assembly needs to Assert the
permission that will be demanded by the underlying framework, perform the
protected operation and then revert the assert.
In many cases, your assembly will also need the
AllowPartiallyTrustedCallersAttribute applied to it.
Joe K.

Signature
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks
> Shai
Dominick Baier - 26 Nov 2007 10:17 GMT
That's because of the CAS stack walk.
The fully trusted assembly will walk the stack back to the original caller
to make sure every stack frame has the required permission - this is done
to prevent luring attacks.
You can stop the stack walk inside of your fully trusted assembly. Use the
Assert() method on the corresponding permission class like:
new FileIOPermission(...).Assert();
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
> Hi,
>
[quoted text clipped - 14 lines]
> Thanks
> Shai