Groups | Blog | Home
all groups > asp.net > december 2004 >

asp.net : Sharing UserControls between different sites


Anders K. Jacobsen [DK]
12/5/2004 11:09:31 PM
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

SevDer
12/6/2004 9:48:39 AM
[quoted text, click to view]
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.


--

SevDer
Eugenio Serrano
12/6/2004 5:31:08 PM
Please check this
http://authors.aspalliance.com/stevesmith/articles/netreuse1.asp

--
Saludos,
Eugenio Serrano
NDSoft Consultoria y Desarrollo
MS MVP ASP.Net
Voluntario Ineta Latam (www.ineta.org/latam)


"Anders K. Jacobsen [DK]" <none@at.all> escribió en el mensaje
news:ul94acx2EHA.3452@TK2MSFTNGP14.phx.gbl...
[quoted text, click to view]

Anders K. Jacobsen [DK]
12/6/2004 9:08:06 PM
[quoted text, click to view]

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

Anders

Bryce Budd
12/8/2004 6:35:58 PM
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

[quoted text, click to view]

AddThis Social Bookmark Button