0

I have to build a Web-Application using ASP .NET MVC. It has to serve different customers, each customer accesses the Page via another domain. With this domain the Application is supposed to load the customer specific data. It also has to provide a login mechanism.

I'm fimiliar with JSF, there I would solve this problem via webfilters.

Does ASP.NET MVC provide something similar to webfilters or is there an even better solution so solve this problem?

I really wish there was a tutorial or an example that adresses this problem, but after hours of googeling I could not find anything. I'm probably searching with the wrong keywords, but I don't know how mechanisms like this are called.

Kendoha
  • 99
  • 11
  • So you have one user redirected from abc.com and another redirected from xyz.com and you'd like to display specific content/functionality for each? – timothyclifford Sep 21 '15 at 09:05
  • I want to display the same pages, but filled with different data from the DB – Kendoha Sep 21 '15 at 12:34

1 Answers1

0

There are several ways of doing this, for example you could use routing (Is it possible to make an ASP.NET MVC route based on a subdomain?) but I would simply go with getting the username from the URL.

var user = Request.Url.Host.Split('.')[0];
Community
  • 1
  • 1
devzero
  • 2,510
  • 4
  • 35
  • 55
  • are routes the equivalent to webfilters? – Kendoha Sep 21 '15 at 09:20
  • No, routing is what MVC uses to read the URL and all request information, and based on this directs you to the correct controller and function with the correct model. Authorization and authentication is separate, normally you decorate each controller or function with how you want to Authorize it. I suggest you create the default MVC project and look at how it's done there, as that is a fairly good example. – devzero Sep 21 '15 at 10:52