Compiling / embedding UserControl templates for ASCX for reuse in multiple web applications

Here I am in a real head with scratches ... and this is apparently one of the most annoying ASP.NET topics.

I have a build that implements many Linq custom materials that have zero web features on it. I have an additional assembly that extends this assembly with web behavior.

The behavior associated with the site is implemented using several user controls that are tagged inside UserControls built on ASCX.

I had problems applying a good result to this assembly, so it's easy to redistribute it for use in other applications. Let me check what I have tried so far:

  • Copied ASCX files to a consumer web application using build events; far from perfect and quite a nightmare.
    • A custom VirtualPathProvider is implemented and ASCX templates are built into the assembly as embedded resources. Unfortunately, when you use the Register directive in a consumer application, it creates a constructor declaration as a UserControl, where I need to declare an actual control type; unforeseen (usually) and undesirable.
    • Created a web deployment project to compile UserControls, but the compiled user controls will then become part of another assembly and will no longer come from the class definitions in my web assembly - the assembly should create them depending on the request context.

, 1 - , 2 , , 3. , :

  • App_Code, factory, , ( , ClassName Control).

Theres ASCX , , , , UserControls.

- , -, , , ? ASP.NET, .

+5
1

, , ... , ASCX - -:

  • App_Code, , ASP.NET speshul, , , . -.
    • , - access is denied, aspnet_merge.
    • , , 2 , , . , - -. . :
    • <Organisation>.<TechnologyName>.Web.DLL - - ( ASCX)
    • <Organisation>.<TechnologyName>.Web.UI.DLL - ASP.NET UserControl, -
    • , - Project bin obj , , , , , - - , .
    • , ASP.NET Import ASCX, , web.config <configuration><system.web><pages><namespaces>, , , .

, ! UserControls!

!

+3

All Articles