Question

How ASP.NET compiles its assemblies generally confuses me. It seems that I cannot program against anything outside the App_Code folder. In the application I am working on I have several server side controls and a few user controls. The user controls are outside the App_Code folder and I cannot refer to them from the App_Code folder. It is a "Web Site" project.

How can I refer to the UserControls from the App_Code directory? Is this a compilation issue?

Thanks in advance.

Was it helpful?

Solution

Yes, it is a compilation issue, read a bit more about this same question at

http://www.velocityreviews.com/forums/t119801-accessing-web-user-control-from-class-in-appcode-folder.html

Whilst I'm sure suggesting you convert the web site to a web application is something you have considered doing and rejected, it may be the way forward if accessing your user controls is something you're looking to do frequently.

OTHER TIPS

The way that I have gotten around the app_code issue is by putting all of my classes into a separate project and include the dll from that project as a reference in the web project. That also allows me to reuse the classes in other applications. I believe this is a common practice for business logic and data access when building an application using an n-tier environment.

Are you sure you're referencing the namespace which contains the user controls?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top