Sharing UserControls between different sites

  • Thread starter Anders K. Jacobsen [DK]
  • Start date
A

Anders K. Jacobsen [DK]

Hi

I have some common UserControls i want to share between to sites (on the
same mashine but on diffrent virtual paths).

right now i have on solution file with aprox 10 projects. 2 of these is
webprojetcs wich need to shere some common userControls. Optimally i want a
class libarary project wich contains the controls so i could import the DLL
and use the controls. But that of course doesnt work.

How should i do this? Sinve i only can create UserControls in a webProejct,
and dont want to create a "dummy" webProject from wich I can share
controles. Neither do i want one project to be a "master" project, because
there are....equal.

Any comments?. I imagine the also could be some security issues if i had to
share between so production projects.

Thank in regards
 
S

SevDer

Anders said:
Hi

I have some common UserControls i want to share between to sites (on the
same mashine but on diffrent virtual paths).

right now i have on solution file with aprox 10 projects. 2 of these is
webprojetcs wich need to shere some common userControls. Optimally i want a
class libarary project wich contains the controls so i could import the DLL
and use the controls. But that of course doesnt work.

How should i do this? Sinve i only can create UserControls in a webProejct,
and dont want to create a "dummy" webProject from wich I can share
controles. Neither do i want one project to be a "master" project, because
there are....equal.

Any comments?. I imagine the also could be some security issues if i had to
share between so production projects.

Thank in regards
Don't waste your time doing that.
Basically copy paste the same user controls in both paths.
Files are not several MB's. And the solution that you are thinking will
cause performance problems. You don't need to do it when you don't have to.
 
A

Anders K. Jacobsen [DK]

Don't waste your time doing that.
Basically copy paste the same user controls in both paths.
Files are not several MB's. And the solution that you are thinking will
cause performance problems. You don't need to do it when you don't have
to.

You might be right in your assumption. Guess I strictly don´t need this
generallity.

Anders
 
B

Bryce Budd

Hi,

The recommended method of share a control between multiple web sites is to
create a custom web control and deploy it to the GAC. Then you can
reference it from multiple projects/sites.

While this is not recommended it may get you past your issue.

Site 1:
Store your usercontrols (ascx) in a directory separate from the other
source.

e.g:

Site 1
|-bin
|-images
|-userControls
|- *.aspx

Then add a virtual directory under the root of Site 2 Pointing to the
userControls directory of Site 1

e.g

Site 2
|-bin
|-images
|-UserControls (Virtual Directory)
|- *.aspx

This would in allow you to reference your user controls across sites....but
again I do not recommend it.

Bryce
 

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,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top