473,698 Members | 2,503 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c om 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?CompanyI D=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 1567
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******@discu ssions.microsof t.com> wrote in message
news:38******** *************** ***********@mic rosoft.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.c om 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?CompanyI D=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.Rewrite Path("index.asp x?CompanyId=" + CompanyId.ToStr ing());

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Bill Borg" <Bi******@discu ssions.microsof t.com> wrote in message
news:38******** *************** ***********@mic rosoft.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.c om 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?CompanyI D=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.domai n.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.c om 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?CompanyI D=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.domai n.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
7654
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 there at all? Any feedback would be helpful. Thanks! -Josh
1
1810
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 have different tables for storing info about different companies, their addresses & phone numbers and their field of work (i can't remember exact word in english ;) Tables look like this: 1. Table "company": ID, name, web, email.... 2. Table...
4
2668
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 database. I wonder how i could connect a person to several other id's in a table. I wonder if I can make a string in the database that holds all the id's separated with , for example....?
136
9379
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 code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
19
2357
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 subset of records across all tables is often considered a separate logical system, but sometimes may be treaded ar part of the global system, and there is not simply a 1-m-m... tree among the records in a logical database. Here's an example. A...
5
1452
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 tables. BUT, is it "ok" or the standard practice to go ahead and use the ASPNETDB.mdf to store your own tables?
2
1055
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> </pre>
4
19342
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 and managers, conducted by Inavero Institute for Service Research, 72 percent of salaried employee recruiting involved online job boards. Online job boards draw in more responses and cost a fraction of what traditional methods such as referrals...
0
8680
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
8609
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,...
1
8899
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
8871
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...
0
7738
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5861
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();...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.