Access to ASP.NET User Control in same solution but in different website.....???


I have a user control that I want another site to access. So I have created 2 websites within one solution, one with the User Control (Call it "Server") and another that accesses it(Call it "Client"). If I creat a webpage in "Server" and drag the UC to it, it works. If I create a webpage in "Client" and then drag the "Server" UC to it, it cannot find the UC.

I am aware that one cannot use UCs across completely seperate website, but I sort of thought that if the websites were part of the saem solution then it would be possible.



Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SamJollyAuthor Commented:
Another thought I had on this was to convert the UC to a custom control. However the slight complication here is that the UC inherits a few classes from the "Server" website. Perhaps there is a could way to "Package" up all relevant "Associated" code for the new Custom Control. Perhaps there is a utility or certainly some technique.

Thoughts please ????

Hey Sam,
 You should probably make an "ASP.NET Server Control" project and put both your controls into that.  Then add a reference to it in both the client and server projects.  From there you should be able to register the assembly and add the controls to both projects.
Let me know how it goes,

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SamJollyAuthor Commented:
Hi Elliot,

I have just tried this route today. Basically I precompiled the "Server" site as "single Page Assembly" and then added a reference to the relevant DLL from the "CLient" site which worked so far. But it seems the "reference" takes a copy of the dll and the code runs in the context of the "CLient" site. So what happens to the Database connections that are defined in Web.Config in the "server" site? Also if there are redirects in the CBH then it would expect to find those redirects in the "Client" site. Also I noticed that all the inherited code dlls were copied over. This is looking quite a closely coupled approach to linking site functionality. However my assumptions on how this stuff works may be wrong.

From a conceptual point of view I like a more loosely couple approach and the use of IFrames seem simple and pragmatic.

I know the ideal approach is web services, but this is much more involved.


SamJollyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.