Common code used by multiple ASP.Net applications

Scenario:

Let's say I have four very similar applications (i.e. most of the features are the same, but they are different enough to justify every single application).

What's the best way to reuse common functionality code between them? COM +? Web services?

In general, as a general rule, I usually have the code in a separate project (dll), but anytime that is updated, the file has to be updated for every ASP.Net application and was not sure if there was a better way about this.

Thank!

0


source to share


3 answers


If possible, you can create a Visual Studio solution with a DLL project and multiple web application or website projects. The web projects will have a reference to the project type for the DLL project and everything will build at the same time. Then you can use the Publish tool for each of your web projects as needed.



+4


source


If all applications are on the same virtual server, consider hosting a shared assembly in the GAC. This allows you to reject versions if needed and keeps everything in one place with a bonus. Disadvantages: This assembly is fully trusted, and you must use policy and CAS to ensure that there are no trust points for untrusted external assemblies. You also need to know about the [AllowPartiallyTrustedCallers] attribute.



As for the other options, COM +, meh, is a bit heavyweight. Good for transactional stuff. Web services, which aren't great for data services, but if done right, they can be pretty handy. The more it divides, the better it pays off.

+2


source


You can have your project, but instead of adding the shared DLL to the project reference, add the shared project to all solutions and then add the shared project reference.

Thus, you can have one project on any number of solutions, and the problem is solved by you;)

+1


source







All Articles