views:

275

answers:

1

I have the requirement to call an internal method of a 3rd party object (I cannot make it public for example). I can do that via reflection. Unfortunately this does not work in ASP.NET Medium trust due to insufficient rights:

<IPermission class="ReflectionPermission" version="1" Flags="RestrictedMemberAccess"/></PermissionSet>

Is there any way I can internal methods in this case? I've heard that LINQ expressions can be used to call private/internal methods. Would expression methods somehow override the ReflectionPermission?

+1  A: 

I don't see a way to call it. The .NET security/trust model is designed to prevent exactly this sort of thing. If you could somehow circumvent it, you would have to file a security bug with Microsoft which would then (hopefully) be fixed and make your solution useless again ;-)

Can't you negotiate a higher trust level with the deployer/operator of your solution?

TToni
I ended up with the same conclusion. After all that's what code security is for :) I should find some other way to implement the requested feature.
korchev