By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,247 Members | 871 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,247 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
>
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 discussion thread is closed

Replies have been disabled for this discussion.