When the web site is dynamically compiled, all the classes in the App_Code directory are compiled together into a single assembly (or possibly one assembly for each class). Let's call this assembly A (for App_code).
When you request the page, the parsed markup and codebehind are compiled into another assembly (again, maybe 2, 1 for markup 1 for codebehind or maybe just 1 single that contains both). Let's call this assembly P (for page).
The important part here is that the App_code and page classes in question are in different assemblies which are created at runtime.
Your Friend keyword ('internal' in C#) is behaving as designed. The class method is internal to assembly A and not publicly visible to assembly P.
If you used a web application project, every class in your project (including code-behind, but excluding the dynamically generated classes based on the markup parsing) are included in the assembly, thus making Friend/internal members visible.
You need to make any class members in App_code public if you wish to use on them in pages. Or you can switch to a web app project.
-Peter
|