Using Code Access Security Without GAC

I'm wondering if it is possible to use Code Access Security and a custom class (and attribute) without having to register the assembly that this attribute is in with the GAC.

I am currently getting a TypeLoadException when a method with my attribute is called and I cannot get around it. Everything I've read seems to imply that you need to use the GAC to do this.

Does anyone have discernment?

I tried to achieve the same end goal with AOP using PostSharp or AspectDNG, but both of them add a dependent dependency on my product, which is not ideal.

+1


source to share


2 answers


I would say yes (but can't be sure no more detail on what and how you are doing). We have custom permissions / roles with CAS and nothing is in the GAC on security. Ultimetly CAS will need to access the implementation of your IPrincipal assembly. Have you looked at the merge log to determine where your builds are being checked?



+1


source


Thank. You just can't seem to have your custom attributes as child classes and you only have to have one constructor that takes a SecurityAction.



+1


source







All Articles