473,396 Members | 2,068 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,396 software developers and data experts.

Best practice for multiple "companies" in one database/site

Hello,

I have a large commerce app, hosted for several hundred companies (i.e. each
"company" is a small business selling something through my site, independent
of all the others).

Each company has a unique ID (e.g. 12345), which is a primary key in the
tables for products, customers, etc. That key also identifies
company-specific customization of my site, such as text strings, various
styles, etc.

I am hosting the app for all customers from a single site and with a single
database. The end customers come to my/my customer's site in one of three
ways: 1) via me.com/myCustomer or 2) via myCustomer.me.com or 3) via
myCustomer.com.

Given all that, here's my question: When a customer comes in via one of the
three ways, how do I then map that to the url I really want, e.g.
me.com?CompanyID=12345? (I have a table that associates the entry point with
the actual ID)

I think it might involve url rewriting, but I've not done that, and there
might be better ways. Any "best practice" thoughts from similar situations
are appreciated.

tia,

Bill
Nov 18 '05 #1
4 1552
Hi Bill,

It's really a simple matter of redirecting with a QueryString. Of course,
I'm assuming that you do have a method in place that identifies the Comany
ID of the company.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living

"Bill Borg" <Bi******@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
Hello,

I have a large commerce app, hosted for several hundred companies (i.e. each "company" is a small business selling something through my site, independent of all the others).

Each company has a unique ID (e.g. 12345), which is a primary key in the
tables for products, customers, etc. That key also identifies
company-specific customization of my site, such as text strings, various
styles, etc.

I am hosting the app for all customers from a single site and with a single database. The end customers come to my/my customer's site in one of three
ways: 1) via me.com/myCustomer or 2) via myCustomer.me.com or 3) via
myCustomer.com.

Given all that, here's my question: When a customer comes in via one of the three ways, how do I then map that to the url I really want, e.g.
me.com?CompanyID=12345? (I have a table that associates the entry point with the actual ID)

I think it might involve url rewriting, but I've not done that, and there
might be better ways. Any "best practice" thoughts from similar situations
are appreciated.

tia,

Bill

Nov 18 '05 #2
I agree with your assessment that URL Rewriting would be the way to go. I
wrote a bit about it at:
http://openmymind.net/localization/i...tml#urlrewrite

it's with respect to cultures, but you should be able to use it for your own
needs.

The basic idea is on Begin_Request you figure out the customer id (via your
association table) and simply do a
Context.RewritePath("index.aspx?CompanyId=" + CompanyId.ToString());

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bill Borg" <Bi******@discussions.microsoft.com> wrote in message
news:38**********************************@microsof t.com...
Hello,

I have a large commerce app, hosted for several hundred companies (i.e. each "company" is a small business selling something through my site, independent of all the others).

Each company has a unique ID (e.g. 12345), which is a primary key in the
tables for products, customers, etc. That key also identifies
company-specific customization of my site, such as text strings, various
styles, etc.

I am hosting the app for all customers from a single site and with a single database. The end customers come to my/my customer's site in one of three
ways: 1) via me.com/myCustomer or 2) via myCustomer.me.com or 3) via
myCustomer.com.

Given all that, here's my question: When a customer comes in via one of the three ways, how do I then map that to the url I really want, e.g.
me.com?CompanyID=12345? (I have a table that associates the entry point with the actual ID)

I think it might involve url rewriting, but I've not done that, and there
might be better ways. Any "best practice" thoughts from similar situations
are appreciated.

tia,

Bill


Nov 18 '05 #3
Good stuff, thank you both. I'm closer to understanding, but still don't get
some basics.

For one, *where* does this interception happen? I picture it like this: I
try to go to www.domain.com, IIS looks down its list, finds default.aspx, and
loads it up, which if this is the first time in then spins up the app. Where
in there am I saying "don't really go find default.aspx, find something
else"? I understand the custom httpModule, but where does *it* live and how
am I telling all the different entry points to always go there so it can do
its mapping?

And, is anything different when I go to subdomain.domain.com vs.
domain.com/folder? In the subdomain case, don't I need an app sitting there
at each subdomain location, or do I handle the mapping at a higher location
(DNS all pointing to the same spot?)?

Bill

"Bill Borg" wrote:
Hello,

I have a large commerce app, hosted for several hundred companies (i.e. each
"company" is a small business selling something through my site, independent
of all the others).

Each company has a unique ID (e.g. 12345), which is a primary key in the
tables for products, customers, etc. That key also identifies
company-specific customization of my site, such as text strings, various
styles, etc.

I am hosting the app for all customers from a single site and with a single
database. The end customers come to my/my customer's site in one of three
ways: 1) via me.com/myCustomer or 2) via myCustomer.me.com or 3) via
myCustomer.com.

Given all that, here's my question: When a customer comes in via one of the
three ways, how do I then map that to the url I really want, e.g.
me.com?CompanyID=12345? (I have a table that associates the entry point with
the actual ID)

I think it might involve url rewriting, but I've not done that, and there
might be better ways. Any "best practice" thoughts from similar situations
are appreciated.

tia,

Bill

Nov 18 '05 #4
>
And, is anything different when I go to subdomain.domain.com vs.
domain.com/folder? In the subdomain case, don't I need an app sitting
there at each subdomain location, or do I handle the mapping at a
higher location (DNS all pointing to the same spot?)?


For the "folder" situation, it might be best to add a "404.aspx" page to IIS.
If the folder doesn't exist, then IIS normally gives a 404 error, without
activating your application (an httpmodule there will not be called).
By handling that 404 with a page that lives inside your application, you
can do your own redirecting there.

Hans Kesting
Nov 18 '05 #5

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

Similar topics

15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
1
by: Cpt. Zeep | last post by:
Although this is not strictly PHP related question, i presume lots of you are good in MySql so maybe you could help me. I am making sort of yellowpages application and have following issue: I...
4
by: Christopher Brandsdal | last post by:
Hi! I have a delicatg problem.... I have made a registration form for adding my friends information in a database. The problem is that I want to connect the persons with companies in the same...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
19
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a...
5
by: VB Programmer | last post by:
If you want to store custom tables in ASP.NET 2.0, such as Products, Companies, Shopping Carts, etc... where is the standard place to put the tables? I want to link it to the user/membership...
2
by: furqanms | last post by:
Hello Friends I am developing a project in asp.net 2005 with c# and sqlsever 2005.In a project I have multiple companies in a group. As Below <pre> ...
4
Niheel
by: Niheel | last post by:
http://bytes.com/images/howtos/career_opps_online_profswanted.jpgFor tech professionals, the best opportunities are being posted on online job boards. In a recent survey of 1,000 HR professionals...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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.