0

Whenever a new user is created, a subdomain should be automatically created.

user1.abc.com
user2.abc.com

Is there a way to achieve this through code?

Update:

To create a subdomain I goto applicationhost.config file and add:

<binding protocol="http" bindingInformation="*:1122:abc.localhost" />

I'm looking for a generic way to create sub-domain where I don't have to edit applicationhost.config manually.

Update 2:

How my question is different from this. The step 4 of the answer accepted as right is relevant to my question and no explanation is provided for Subdomains on localhost IIS.

Irfan Y
  • 1,242
  • 2
  • 21
  • 68
  • 1
    Pretty much anything CAN be done, the question really should be "Here is what I tried code" and "My current problems is..".state your issue. – Mark Schultheiss May 28 '18 at 12:32
  • There seem to be similar questions. LMGTFY Put this in your google search: "create subdomain for each user site:stackoverflow.com" – Mark Schultheiss May 28 '18 at 12:35
  • Possible duplicate of [How to create subdomain with username using C# and asp.net?](https://stackoverflow.com/questions/1437277/how-to-create-subdomain-with-username-using-c-sharp-and-asp-net) – Mark Schultheiss May 28 '18 at 12:37
  • @J.Loscos seems like the blogger is facing same issue that I am facing :) It says: `I haven't found a way to make my host accept a wildcard so I basically just added to entries in it` – Irfan Y May 28 '18 at 12:53
  • @MarkSchultheiss please see updated question – Irfan Y May 28 '18 at 12:55
  • you could use wildcard in your binding to catch all subdomains : `*:1122:*.localhost` The problem with localhost is that it's the host file that defines it and it doesn't accept wild cards so each subdomains has to be defined manually in it. But that's only an issue on localhost. In production environment you have DNS were you could use wildcards to redirect all subdomains to your application – J.Loscos May 28 '18 at 13:20

0 Answers0