Question

This question is different from the others because all of the questions I've seen so far are talking about the database. I understand the database side of multitenacy, but I'm not 100% sure on the way to do the front end.

I'm working on the design for a product that will basically be a hosted service for customers. As far as the multitenacy goes, you can think of a hosted FogBugz account. The customer signs up, they get their own subdomain, and then they go to customersubdomain.thenormalurl.com and login to their little portion of the application.

When the customer signs up we will need to setup a DNS record for the sub domain, but from the application side of it, how do we "scope" the application to that customer? Is it just supposed to look at the url that the request was made to or is there some other way? That seems overly simple to me, but maybe I'm just trying to complicate something that should be simple.

How is this normally done in the ASP.Net world?

Was it helpful?

Solution

Yeah, just look at the subdomain. If your users log in, then you can ignore the subdomain and figure out who they are by their login credentials. After you figure out who they are, then it's just a matter of getting the right data and not showing the wrong data. And that's where all those DB questions come in. You do that 'scoping' by either using separate DBs or by marking all your records with keys to the customer. So your app has to implement that.

OTHER TIPS

Luke Sampson has some techniques and sample code for multi-tenant applications using sub-domains under ASP.NET MVC here:

http://blog.lukesampson.com/subdomains-for-a-single-application-with-asp-net-mvc

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top