473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to share user control between multiple websites

I'm using asp.net 2.0 and c# and would like to share some user control
between several websites. these websites are on the same server and have a
physical location right next to each other like this:

D:\Websites\Website1
D:\Websites\Website2

I'm thinking of putting the controls for sharing in a common directory like
this:
D:\Websites\CommonControls

What's the recommened way to do this and are there any special
conciderations to keep in mind?

FYI: These shared controls will be accessing databases and reading/writing
images to the directory.
Thanks

--
mo*******@noemail.noemail
Mar 11 '07 #1
9 4276
I'm actually working out my own user control problem. In my searches I
stumbled upon this:
http://aspadvice.com/blogs/ssmith/ar...n-ASP.NET.aspx

Maybe it will help :)
Brad

"moondaddy" <mo*******@noemail.noemailwrote in message
news:ei**************@TK2MSFTNGP04.phx.gbl...
I'm using asp.net 2.0 and c# and would like to share some user control
between several websites. these websites are on the same server and have
a physical location right next to each other like this:

D:\Websites\Website1
D:\Websites\Website2

I'm thinking of putting the controls for sharing in a common directory
like this:
D:\Websites\CommonControls

What's the recommened way to do this and are there any special
conciderations to keep in mind?

FYI: These shared controls will be accessing databases and
reading/writing images to the directory.
Thanks

--
mo*******@noemail.noemail

Mar 11 '07 #2
On Mar 11, 9:34 pm, "moondaddy" <moonda...@noemail.noemailwrote:
I'm using asp.net 2.0 and c# and would like to share some user control
between several websites. these websites are on the same server and have a
physical location right next to each other like this:

D:\Websites\Website1
D:\Websites\Website2

I'm thinking of putting the controls for sharing in a common directory like
this:
D:\Websites\CommonControls

What's the recommened way to do this and are there any special
conciderations to keep in mind?
Consider to build a Class Library or Web Control Library.
http://www.codeguru.com/csharp/.net/...le.php/c12725/

Mar 11 '07 #3
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
>What's the recommened way to do this and are there any special
conciderations to keep in mind?

Consider to build a Class Library or Web Control Library.
http://www.codeguru.com/csharp/.net/...le.php/c12725/
Yep, that's definitely the way...
Mar 11 '07 #4
Thanks for your replies.

These user controls are more like content pages rather than a specific type
of control with functionality like a grid or something. in many cases they
just have static text. I have 2 websites that could share some common
content (webforms, html pages, or user controls). I thought it would be
easier to maintain the content (update the text from time to time) if it
were in one place rather than redundantly placed in each site.

does this change your advice?
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:eU**************@TK2MSFTNGP04.phx.gbl...
"Alexey Smirnov" <al************@gmail.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
>>What's the recommened way to do this and are there any special
conciderations to keep in mind?

Consider to build a Class Library or Web Control Library.
http://www.codeguru.com/csharp/.net/...le.php/c12725/

Yep, that's definitely the way...

Mar 12 '07 #5
"moondaddy" <mo*******@noemail.noemailwrote in message
news:O5****************@TK2MSFTNGP06.phx.gbl...
These user controls are more like content pages rather than a specific
type of control with functionality like a grid or something. in many
cases they just have static text. I have 2 websites that could share some
common content (webforms, html pages, or user controls). I thought it
would be easier to maintain the content (update the text from time to
time) if it were in one place rather than redundantly placed in each site.

does this change your advice?
Not at all, though a full-blown web control library might be a bit overkill
if we're talking only of a few small files...

Another way would be to use a product such as Microsoft Visual SourceSafe...
Apart from the source control functionality (which every serious developer
should be using anyway...), this allows individual files to be "shared"
across multiple projects. Although a copy of the file does exist separately
in each project, when you update it in one project it gets updated in all
other projects into which it has been shared...

I use this quite a lot for things like individual debugging pages which I
always add to every public internet web app I build...

Depending on which version of Visual Studio.NET you have, you probably
already have a copy of Visual SourceSafe...
Mar 12 '07 #6
Hello Moondaddy,

Naturally, ASP.NET usercontrol(ascx) is not designed for reuse scenario,
just like aspx pages. Scottgu has ever posted a blog article demonstrate
how to make ASP.NET acsc usercontrol and page reusable in multiple projects
in ASP.NET 2.0:

#Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005
http://weblogs.asp.net/scottgu/archi...28/423888.aspx

However, such approach has some certain natural limitations due to the
underlying design and implementation of usercontrol. If possible, I would
recommend you consider other means to build those reusable components. Such
as create custom webserver controls, or just define some shared include
files that be used in multiple projects.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 12 '07 #7
It doesn't matter where you put the files for the controls or how you
use them, as the two web sites are separate applications, you will
always have a separate instance of the user controls for each application.

If you want to share data between the applications, you have to do it on
a lower level, like creating a windows service that runs on the server
that both applications can communicate with.

--
Göran Andersson
_____
http://www.guffa.com
Mar 12 '07 #8
Thanks to all. it sounds like a shared include file would be the way to go.
Can you recommend a resource describing how to use a shared include file in
such a scenario?

Thanks.
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:HS**************@TK2MSFTNGHUB02.phx.gbl...
Hello Moondaddy,

Naturally, ASP.NET usercontrol(ascx) is not designed for reuse scenario,
just like aspx pages. Scottgu has ever posted a blog article demonstrate
how to make ASP.NET acsc usercontrol and page reusable in multiple
projects
in ASP.NET 2.0:

#Building Re-Usable ASP.NET User Control and Page Libraries with VS 2005
http://weblogs.asp.net/scottgu/archi...28/423888.aspx

However, such approach has some certain natural limitations due to the
underlying design and implementation of usercontrol. If possible, I would
recommend you consider other means to build those reusable components.
Such
as create custom webserver controls, or just define some shared include
files that be used in multiple projects.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Mar 12 '07 #9
Thanks for your reply Moondaddy,

About referencing include template in ASP.NET here are some public article
you can refer to:

#How To Dynamically Include Files in ASP.NET
http://support.microsoft.com/kb/306575

#ASP.NET Page Templates - Using Inheritance
http://www.codeproject.com/aspnet/page_templates.asp

#Using include files with ASP.NET
http://www.christopherjason.com/arti...ludes-asp-net/

#Simulating include Files with an ASP.NET Server Control
http://msdn2.microsoft.com/en-us/library/aa479009.aspx

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Mar 13 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: AARON PECORARO | last post by:
I need to split apart my web application into multiple projects to allow it to be distributed in parts, but all of the projects need to work together (ie. they need to share session information)....
4
by: Jay Mack | last post by:
Hello, I converted an Access application that used to have a MDE front-end (distributed to each user) with a MDB back-end on a share. It now has a MDE front-end with linked ODBC SQL Server 2000...
2
by: Eric | last post by:
I have a header server(.ascx) control that I want to use with all my existing seperate web apps. These web apps are configured as seperate web apps in IIS but when I try to build my solutiuon...
6
by: Tony Fonager | last post by:
I am currently developing a statistics system in ASP.NET, and need to share information about the customers websites, in this application. (I have simplified my code, to make my project easier to...
8
by: Tony Fonager | last post by:
I am currently developing a statistics system in ASP.NET, and need to share information about the customers websites, in this application. (I have simplified my code, to make my project easier to...
5
by: Raed Sawalha | last post by:
We have a web application with at least 570 Pages and 10's of user controls ....all under project name LinkDevProject ...recently we start separating the project into multiple projects ....the...
2
by: mail | last post by:
Hi guys, So far I've spent about a week hacking away at this code, and I just can't get it to add an ACE to a the DACL for a network share using WMI. Just to set the scene, I'm trying to add...
15
by: Neo | last post by:
Hello All, I found that ASP.net website only accepts code withing site directory. This creates big hurdle in shairng code. How to share code between two websites, like the way share between two...
3
by: Jonathan Wood | last post by:
I could really use some help on this. First of all, I want to create a Web control where I render the control completely from scratch based on information from a database. In the book...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.