SeyoS
SeyoS

Reputation: 681

How to use internal class on in inline asp code

I try to use an internal class in an inline ASP code.

Ex : <%= MyClass.Method() %>

It's work fine with a public class, but I can't manage to use this with an internal class even with using assembly:InternalsVisibleTo

Is it possible to use an internal class or method in inline code ?

Upvotes: 3

Views: 303

Answers (1)

D-Shih
D-Shih

Reputation: 46229

Internal types or members are accessible only within files in the same assembly.

Because .aspx page is inherited from .aspx.cs code-behind class.

You can only get value by protected or public in .aspx.cs code-behind, otherwise you can't access the field or property.

InternalsVisibleToAttribute attribute only represent you can get the Internal class from another assembly, but the key point is .aspx will render a page and get value <%= MyClass.Method() %> from the code behind- class. there isn't any relationship about another assembly

Upvotes: 2

Related Questions