Best way to share ASP.NET .ascx controls across different website applications?

后端 未结 10 649
轮回少年
轮回少年 2021-01-04 04:39

Suppose you have 2 different ASP.NET applications in IIS. Also, you have some ASCX controls that you want to share across these 2 applications.

What\'s the best way

10条回答
  •  失恋的感觉
    2021-01-04 04:55

    I recently did a web application that just referenced the files (about 90 in total) from one web application (aspx, master and ascx) without too much of an issue. That said I was using a heavily modified version of the MVP pattern, a lot of interfaces and conventions to keep the complexity down, the same middle tier and one site was a subset of the other.

    Big issues:

    1. Master pages (and in turn designers and html view formatting) don’t work on a referenced file so you lose a lot of functionality. A pre-build step and a lot of svn:ignore entries was my hack around this. It was also a pain to get CruiseControl.NET to get the pre-build task to execute in the right folders.
    2. Shared pages/controls need to be extremely aware of what they touch and reference as to avoid bringing in extra dependencies.
    3. Both sites are locked together for deployment.
    4. I now have to pray that the maintainer reads my pokey little document about the mess I made. It’s so far outside of what I’ve seen in ASP.NET projects.

    I was under a massive time pressure to get it to work, it does and now both apps are in production. I wouldn’t recommend it but if you’re interested start at:

    Add Existing Item, select some files, click on the Add button’s arrow and say Add as a Link.

提交回复
热议问题