ASP.NET - multiple applications sharing pages/ controls

S

Shikari Shambu

Hi All,
I have a situation where multiple applications are sharing some pages/
controls.

So, I have a separate common project that has the common pages/ controls.

My question is how do I reference these pages/ controls from my ASP.NET web
projects

WEbApp1 url http://localhost/app1 C:\Apps\App1
WEbApp2 url http://localhost/app2 C:\Apps\App2
Common C:\Apps\Common

And, what are the best practices for scenarios like this

TIA
 
J

John Saunders

Shikari Shambu said:
Hi All,
I have a situation where multiple applications are sharing some pages/
controls.

So, I have a separate common project that has the common pages/ controls.

My question is how do I reference these pages/ controls from my ASP.NET web
projects

WEbApp1 url http://localhost/app1 C:\Apps\App1
WEbApp2 url http://localhost/app2 C:\Apps\App2
Common C:\Apps\Common

And, what are the best practices for scenarios like this

ASP.NET isn't really set up to work like this.

In order to share controls, you should create custom controls instead of
user controls. Multiple site can share the assembly containing the custom
controls.

You can share pages by placing the shared pages into a separate web
application. Then, both App1 and App2 can have links to the shared pages in
App3.

And, of course, you can share common types in an assembly which both web
applications reference.
 
S

Shan Plourde

The approach that I have been using (small scale in house projects) is
to create shared assemblies that I register in the GAC. These shared
assemblies contain my code behind logic. Then in each web application, I
have an .ascx page that extends from the code behinds in the shared
assemblies.

In general I favor this to custom controls in many situations because I
find that it is much much easier to make stylistic changes.

We have had support for symbolic links to files since Windows 2000. I
have used this with success across multiple web applications. I use it
at times for .ascx files that I wish to reuse in other web applications.
You can have your shared .ascx files deployed in the same area as your
shared assemblies that contain your code behinds. I think that this is
good for reuse at a smaller scale.
 
J

John Saunders

Shan Plourde said:
The approach that I have been using (small scale in house projects) is
to create shared assemblies that I register in the GAC. These shared
assemblies contain my code behind logic. Then in each web application, I
have an .ascx page that extends from the code behinds in the shared
assemblies.

In general I favor this to custom controls in many situations because I
find that it is much much easier to make stylistic changes.

We have had support for symbolic links to files since Windows 2000. I
have used this with success across multiple web applications. I use it
at times for .ascx files that I wish to reuse in other web applications.
You can have your shared .ascx files deployed in the same area as your
shared assemblies that contain your code behinds. I think that this is
good for reuse at a smaller scale.

That sounds like a pretty good idea. I forsee a problem with it in larger
projects, which is how do you document it? It's pretty far from the "normal"
way to do things.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top