views:

48

answers:

1

I set the InternalsVisibleTo attribute for the friend assembly. In a controller, I can access the internal class, but if I try to do the same in the aspx/ascx file - "class is inaccessible due to its protection level" .

Any way I could fix this ?

EDIT

I should have made things more clear and specify that the attribute was for resource files that generated the designer class Internal. I just found that i can change the Access Modifier when editing the resx file.

But thanks Darin Dimitrov for the explanation.

+2  A: 

The assembly that will consume this class needs to be signed with a public key. As you are talking about ASPX/ASCX I am afraid that the assembly is autogenerated and not signed especially if you are using a web site vs web application project. But the question here is why on earth would you need to do something like this?

Also you talk about a controller so I assume ASP.NET MVC and if this is the case a View in ASP.NET MVC works only with a ViewModel which is specific to this view. It doesn't ever need to access something else and if it needed there are helpers, etc..., you get the point.

Darin Dimitrov