Question: Domain and subdomain with common code in ASP.NET MVC and Azure

Question

Domain and subdomain with common code in ASP.NET MVC and Azure

Answers 1
Added at 2016-01-14 22:01
Tags
Question

I have a scenario very particular in a project... and I don't know what is the best way to get it work. To set in context, imaging we are programming a TODO Web App in ASP.NET MVC 6 (ASP.NET 5) and hosting in Azure like "Application Web".

We are going to have two sites:

Firs Site: www.mytododomain.com

This website is just for a landing page (marketing typical), but it need to have a register and login page. When the user make login or register, he is redirect to the next website.

Second Site: app.mytododomain.com

This place is when you create your TODO things, you can create, edit, delete, register, login and logoff. And the most important, you can share your TODO lists.

When you share a TODO lists, I need to share a link with the world like this:

mytododomain.com/share/{guid}

Relevant technical information:

  • I'm using Identity 3.0.
  • I am using cooking authentication and sharing the cookie between the subdomain and domain (this will be another goal!!).
  • I need to have two different web projects in my solution and deploy them on two differents Azure Application Web

The reason of that:

We want to have differents code, and different project, because if we deploy a new version of the main www.mytododomain.con web, we wont want to deploy the code app.mytodomain.com

What is the best way to do that?

Thank you so much!!

Answers
nr: #1 dodano: 2016-01-15 05:01

I'm going to assume you are using IIS since you are using .Net.

If your domain and subdomain are going to point to different applications in IIS, then you should definitely have two different applications in your codebase. What I mean by this is that you should have two completely different solutions as these are two different applications.

If you need to share components between the two applications I recommend using a package manager to do so such as NuGet. This will allow you to have two decoupled applications making deployment of one not dependent on changes in the other.

As far as IIS is concerned, you can use IIS Bindings to have users of www.mytododomain.com go to one IIS hosted application and users of app.mytodomain.com go to another.

Source Show
◀ Wstecz