HOWTO implement multiple portal in ASP.Net MVC

873 views Asked by At

I am working on designing a web application for our customers where each customer has a unique portal into the system. Each customer needs to be able to manage their own set of users without concern for other customer's users, thus two different customers need to be able to both have a user jasonsmith.

At the same time, one customers show NOT have any knowledge of the other customer's existences, nor that this is a multi-customer system.

What are the standards today for implementing such a system? Where should I go to learn more about how best to implement such a system.

1

There are 1 answers

0
jgauffin On

What you are talking about is called multitenancy.

There are several approaches to this.

Most common approaches are:

Single database

All tenants share the same database. You'll therefore have one tenants table with the information about all tenants. All other tables uses the tenantid as a foreign key.

The problem is that you have to make sure that the user only accesses it's own information (the user can for instance try to change the id in the uri). You'll therefore have to validate each object that the user has tries to access.

Multiple databases

Some database engines (like RavenDB) can handle several databases without a problem. That means that each customer get's its own database (which you load at the beginning of each request after the user have been identified).

So you'll have one db users during the authentication to be able to identify the tenant and one database per customer.

The upside with this solution is that it's impossible for the tenants to access each others database. (unless they've hacked the account)