473,769 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sharing Objects Between ASP.NET "Sites"/Projects

I'm developing a service which is two sites: a Mobile Site and a PC-Based
Site. The whole goal is to have them operate very similarly but, of course,
there will be many differences:

1. Web.configs will be different to handle cookieless vs. cookied Sessions
2. Mobile site will have no Master Pages (unfortunately)
3. Design of pages will be VASTLY different

However, many elements will be exactly the same:
a. I'll use most of the same classes for data access and other business
objects
b. The database in the backend is the same database

Here's my question: What's the best strategy for building these sites to
share code that's the same? It seems that in order to have two different
Web.comfigs (which I think I *must* have to support the differences between
Mobile and PC stuff), I must basically have two different sites. If I have
two different sites, I must have two different "App_Code" directories. This
means, I think, that I cannot share the same class files between the two
sites and must make copies of them. This seems like a shame.

Is there a better way to do all this?

Thanks for your help.

Alex
Jun 3 '07 #1
5 1734
you should create 2 sites (web projects) and 1 library project, that is
referenced from both sites. put all shared code in the library project.
you can create one solution for all of this.

you could also just use one site and auto detect on session cookie. but
above is probably better.

-- bruce (sqlwork.com)

Alex Maghen wrote:
I'm developing a service which is two sites: a Mobile Site and a PC-Based
Site. The whole goal is to have them operate very similarly but, of course,
there will be many differences:

1. Web.configs will be different to handle cookieless vs. cookied Sessions
2. Mobile site will have no Master Pages (unfortunately)
3. Design of pages will be VASTLY different

However, many elements will be exactly the same:
a. I'll use most of the same classes for data access and other business
objects
b. The database in the backend is the same database

Here's my question: What's the best strategy for building these sites to
share code that's the same? It seems that in order to have two different
Web.comfigs (which I think I *must* have to support the differences between
Mobile and PC stuff), I must basically have two different sites. If I have
two different sites, I must have two different "App_Code" directories. This
means, I think, that I cannot share the same class files between the two
sites and must make copies of them. This seems like a shame.

Is there a better way to do all this?

Thanks for your help.

Alex
Jun 4 '07 #2
Bruce -

Thanks. This is *very* helpful. You mean a "Class Library" project, right?
That does make sense. Just one question: I *do* suppose that that mean that
the nice, automatic compilation business that you get when you put your .cs's
inside the App_Code directory won't happen, right? Still, it's better than
the awful copying that I've been doing.

Alex

"bruce barker" wrote:
you should create 2 sites (web projects) and 1 library project, that is
referenced from both sites. put all shared code in the library project.
you can create one solution for all of this.

you could also just use one site and auto detect on session cookie. but
above is probably better.

-- bruce (sqlwork.com)

Alex Maghen wrote:
I'm developing a service which is two sites: a Mobile Site and a PC-Based
Site. The whole goal is to have them operate very similarly but, of course,
there will be many differences:

1. Web.configs will be different to handle cookieless vs. cookied Sessions
2. Mobile site will have no Master Pages (unfortunately)
3. Design of pages will be VASTLY different

However, many elements will be exactly the same:
a. I'll use most of the same classes for data access and other business
objects
b. The database in the backend is the same database

Here's my question: What's the best strategy for building these sites to
share code that's the same? It seems that in order to have two different
Web.comfigs (which I think I *must* have to support the differences between
Mobile and PC stuff), I must basically have two different sites. If I have
two different sites, I must have two different "App_Code" directories. This
means, I think, that I cannot share the same class files between the two
sites and must make copies of them. This seems like a shame.

Is there a better way to do all this?

Thanks for your help.

Alex
Jun 4 '07 #3
Hi Alex,

Based on your description, you're building two websites, one for mobile
clients and one for normal pc clients and they have same functionality and
backend data store, so you're wondering how to share the code logic as much
as possible between them, correct?

For this scenario, I think the most different of the two websites here are
of the ASP.NET front-UI interfaces, Mobile application's front UI layout
and display differ much from normal web application. I think what you can
share most between them should be the middle tier business or data access
components. Such as validation rules or data access utilities.

As you've mentioned that you will need to create separate copy of classes
put in each application's App_Code folder. Then, I suggest you consider
move much classes(that is common to both applications) into a shared class
library project. And both of the two web application can reference to the
same class library project to use those common component classes. How do
you think?

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.
Jun 4 '07 #4
Steven -

Yes, I agree. The thing is, I really have come to love the whole idea of the
App_Code directory because it allows me to publish the site just by copying
all of the source files without having to compile and build and all that. I
guess there's no way to do that when you are creating a separate class
library, right?

Alex
"Steven Cheng[MSFT]" wrote:
Hi Alex,

Based on your description, you're building two websites, one for mobile
clients and one for normal pc clients and they have same functionality and
backend data store, so you're wondering how to share the code logic as much
as possible between them, correct?

For this scenario, I think the most different of the two websites here are
of the ASP.NET front-UI interfaces, Mobile application's front UI layout
and display differ much from normal web application. I think what you can
share most between them should be the middle tier business or data access
components. Such as validation rules or data access utilities.

As you've mentioned that you will need to create separate copy of classes
put in each application's App_Code folder. Then, I suggest you consider
move much classes(that is common to both applications) into a shared class
library project. And both of the two web application can reference to the
same class library project to use those common component classes. How do
you think?

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.
Jun 4 '07 #5
Thanks for your reply Alex,

Yes, I agree that a class library project can not offer such feature that
make the source code directly deploy in target directory(witho ut
precompile). However, for optimized deployment scenario that need
precompilation, using separate class library to seprate shared code logic
would be good idea.

Sincerely,

Steven Cheng

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

Jun 5 '07 #6

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

Similar topics

2
3073
by: a | last post by:
I keep getting this message, "unable to get the project file from the web server" when I try to open a new project that I just copied. I created a virtual director with IIS 5 (VS2002). Trying to setup Rainbow. Suggestions? Thanks, Andy ac411@bellsouth.net
4
1650
by: Anders K. Jacobsen [DK] | last post by:
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.
54
6458
by: m.roello | last post by:
In the book: "Working with Microsoft Visual Studio 2005" Craig Skibo wrote: "The power of Visual Studio 2005 lies in its ability to empower users to build, test, and debug powerful applications quickly and easly." I don't agree on what concernes ASP .NET Web Sites in VS2005. All what involves Namespaces in Web sites has been disappeared. I know you can still MANUALLY manage them, but not QUICKLY and EASLY. In a
13
3114
by: Alan Silver | last post by:
Hello, MSDN (amongst other places) is full of helpful advice on ways to do data access, but they all seem geared to wards enterprise applications. Maybe I'm in a minority, but I don't have those sorts of clients. Mine are all small businesses whose sites will never reach those sorts of scales. I deal with businesses whose sites get maybe a few hundred visitors per day (some not even that much) and get no more than ten orders per day....
15
5816
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 non-website code? -Pravin
2
5986
by: Lucky | last post by:
hi guys, few days back i've posted a question regarding how can i get the list of the websites form the IIS, at this location: http://groups.google.com/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/97f4f07b8b46a397/41372cde30df29e7?lnk=st&q=how+to+get+list+of+websites+from+IIS+C%23&rnum=1&hl=en#41372cde30df29e7 and i got a nice replay. it worked. now the problem is different when i tried the code on the...
12
1928
by: Tyno Gendo | last post by:
Hi everyone I wondered what if any methods people here use to speed up their PHP code (ie. speed at which you produce your code). Things like 'code templates', 'base objects' for this and that? I thought it would be interesting to find out if I'm missing out any anything cool that could aid in speeding up development.
19
2235
by: maya | last post by:
hi, so what is "modern" javascript?? the same as "DOM-scripting"? i.e., editing content (or changing appearance of content) dynamically by massaging javascript objects, html elements, etc? (in conjunction with css, you know, the usual...;) this is what is meant by "modern" javascript?? so how do folks feel about this who think javascript is so evil they disable it from their browsers?? do sites designed with "modern" javascript...
3
11217
by: Jethro | last post by:
Hi guys, I have inherited a .NET 2.0 web project. It consists of a root site, and 3 sub directories. Ideally these are seperate projects/websites. The root is a customer- facing one, and the other 3 are for admin, and supervisor use. I want to break the existing project (all websites treated as one) into 4 separate websites.
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.