How to allow a user to use their own domain name for a hosted service?

I am working on an ASP.NET MVC web application that allows people to publish content, but besides publishing content to a remote server, I want people to be able to directly use their domain name. For example, the user "Tom" can indicate his TomSite.com domain name at http://www.mywebapp.com/user/tom , but an additional path will also be displayed. For example, TomSite.com/path will be mapped to www.mywebapp. com / user / tom / path and it is transparent to the web visitor. A visitor will never see "mywebapp.com" anywhere on TomSite.com.

I think Smugmug.com provides such a service to allow people to use their own domain name for a portfolio of photographs. I want to achieve the same result.

How can i do this? Thank!

+3
source share
4 answers

This requires a few steps.

First you need to find out how your users will configure their domain to record CNAME for your site. You can archive this in several ways where education is best. Creating partnerships with hosting providers requires a large amount.

In IIS, this requires that you either add each host name manually (however, it could also be archived using scripts), or have a dedicated IP address only for your site.

, . , , , , , . ( System.Net).

if (Dns.GetHostEntry("www.user.example.com").HostName == "www.example.com")
{
    // www.user.example.com is a CNAME for www.example.com
}

ASP.NET MVC . , Route, .

+2

( ) CNAME, URL- . , , , , .

, www.tomsite.com , www.mywebapp.com, - . , - - (Smugmug, , ​​ GoDaddy).

, ​​ - , - ( , , ).

. - (, URL) , , , , , .

+1

IP- -.

IIS , , -, . IIS -, . - . .

- . ( "*" ), .

- "" node. "" Bindings..., " ". , , , http * 80. "...". .

IIS7 - node. , -. , ( ) .

+1

- tomsite.com mywebapp.com/user/tom/?

:)

Of course, since you are based on asp.net/windows, I think you will have to delve into IIS to automate this kind of thing. If you were on apache, this would add 3 simple lines to httpd.conf.

0
source

Source: https://habr.com/ru/post/1697614/


All Articles