MVC 5 Subdomains

I want to make portal with subdomains. here is example:

Main page (login + urls to all subdomains):

www.car.com

Subdomains:

www.bmw.car.com www.audi.car.com etc here will be many many more sites

What i want to accomplish is:

  • Common loggin and authorization (for example if you'll log in to bmw.car.com you will be automaticaly logged in audi.car.com)

  • Common database (every articles will be in 1 database but this is easy problem to manage just by module for example)

  • Every site will have own layout (depend on module audi/bmw). Dierences in layout will be in db.

  • how to achieve this?

    Conclusion:

    I want to have one site which will load different data depends on subdomain name. How i should regonize subdomains? And second question, will google recognize each site as independent site? Its is very important to me.


    This is really not difficult. Create a single solution with multiple projects (one for each site). Design the template and views however you like in each project. Put common bits in a class library project with a reference to that in each project that needs it. For shared auth, you just need to set your authentication cookie on *.yourdomain.com. Each subdomain will get the cookie, then. When you're ready to deploy, you just create multiple sites in IIS, bound to whichever subdomain they should be and deploy your apps appropriately.


    I think a different design pattern would be to use a MultiTenancy paradigm?

    Here is a great article to get you started: Simple Multitenancy with ASP.NET MVC

    链接地址: http://www.djcxy.com/p/70372.html

    上一篇: 在iis中有多个子域的asp.net mvc站点

    下一篇: MVC 5子域