Details of question follow the scenario. Please do not respond saying simply "Use ReflectionPermissions", because it does not work alone and I have confirmed that. Please only reply if you honestly
know how to set a website to trust a class library and how to enable private Classes and Class Members declared on a website (from the app code directory, not partial classes or anything like that) to be exposed to an included library through System.Reflection
(this.GetType().GetMembers(NonPublic) for example).----------------------------------------------------------------------------------------------------Scenario:On
Website, in App Code directory:-----------------------------------using ...using
MyLib;namespace Stuff{public
class SomeClass : MyOb{private int m_someInt;}}------------------------------------In
Library------------------------------------using ...namespace
MyLib{public class MyOb {
protected void SomeFunc() { MemberInfo Mems = this.GetType().GetFields(BindingFlags.NonPublic);
/// UNDER THESE CIRCUMSTANCES, Mems would always contain a list /// of public members and members inherrited by or declared in MyOb.
/// In the case of executing under class SomeClass on the website, /// I want private int m_someInt to show up.
}
}}------------------------------------------------------------------------------------------------------------------As
usual, Microsoft documents all but the most essential information with respect to their features, and ReflectionPermissions is no acception. All of the documentation demonstrates how to prevent reflection against local members, which in the case of private
members is done by default. Their documentation however leads me to believe that there is a way to enable objects (in this case, a base class from another assembly) to reflect even private members and interact with them across multiple assemblies, but not
even step 1 is given thoughout their riggorous documentation. Is there any chance that someone knows how to do this and can offer a suggestion?Thanks
in advance!
dj_oldfield
0 Points
1 Post
Problem related to Reflection Permission (attempting to use library inside of website)
Oct 22, 2007 09:42 PM|LINK
}}------------------------------------------------------------------------------------------------------------------ As usual, Microsoft documents all but the most essential information with respect to their features, and ReflectionPermissions is no acception. All of the documentation demonstrates how to prevent reflection against local members, which in the case of private members is done by default. Their documentation however leads me to believe that there is a way to enable objects (in this case, a base class from another assembly) to reflect even private members and interact with them across multiple assemblies, but not even step 1 is given thoughout their riggorous documentation. Is there any chance that someone knows how to do this and can offer a suggestion? Thanks in advance!
</div>