1

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:

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

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

  3. 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.

tereško
  • 58,060
  • 25
  • 98
  • 150
Ellbar
  • 3,984
  • 6
  • 24
  • 36
  • I assume asp.net mvc? You do realize your question is very broad and hard to answer as there are many possibilities. – rene Dec 11 '13 at 15:34
  • Yes ASP.NET MVC + Entity Framework 6. I just want to make portal with many sites but every one of them will have the same layout but different colors/logo/images. Menu on every site would be loaded dynamically from DB. I just want to common logging. Here is example: http://bajo.pl There are many sites with common layout, different color themes and common users. I guess everything is in one db. I would like to know what is the best practise in this type of projects. In addition I'll using code first i it changes anything... – Ellbar Dec 11 '13 at 15:38
  • Well, start coding then. asp.net mvc, routing and membershipproviders offer all functionality you need. Ask a more precise question when you are stuck with a specific peace of code. – rene Dec 11 '13 at 15:43
  • But this is architection issue. Its hard to start coding without vision how this should be working :( – Ellbar Dec 11 '13 at 15:45
  • In that case you might be better off asking at programmers.stackexchange.com http://programmers.stackexchange.com/help/on-topic – rene Dec 11 '13 at 15:50
  • I Would like to know if you archived this, Im trying to do the same for my application. – Luis Tellez Mar 05 '14 at 13:46

2 Answers2

0

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.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
  • Hello, but i dont need project for each solution. Design (layout) for each page will be the same, the differences will be only color theme and logo. All articles, main menu etc will load rom DB. For example if I have bmw.car.com and audi.car.com and you will request the firs site i would like to have global parameter or something which will be have enum of which site is actually opened. All datas will be loaded properly for each site. Is this good way to go? And if it is so ow to keep information about actual site? – Ellbar Dec 11 '13 at 16:14
0

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

J-Rome
  • 155
  • 1
  • 8