Ravi Ravi - 1 year ago 92
C# Question

How to create subdomain with username using C# and asp.net?

When a user registers with my site, they will get a url like this "http://username.mysite.com" to access their page/folder. How this is possible using C# and asp.net mvc.

Any help is appreciated.

Answer Source

I was also looking to implementing your scenario and have some links bookmarked. Maybe this will get you on your way until some SO superstar gives another complete sample ;)

http://blogs.securancy.com/post/ASPNET-MVC-Subdomain-Routing.aspx (link down)

  • Step 1: Custom RouteBase
  • Step 2: Create the Controller
  • Step 3: Register the Routes
  • Step 4: Subdomains on localhost IIS

At the end of the article, it also references another SO post:

Is it possible to make an ASP.NET MVC route based on a subdomain?

It seems like a SO superstar has already answered the question :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download