I am learning .Internet MVC 2 and want to understand how I possibly could start creating sub-domain names for a listing of metropolitan areas which i have saved inside a table. It might be nice when they were in some way produced dynamically when i add metropolitan areas towards the table.

For Instance:

  • seatle.mysite.com
  • calgary.mysite.com
  • orlando.mysite.com

I would like for this to operate during my local "Dev" atmosphere (home windows 7, IIS 7) and also on my live site (hosting that is shared, limitless sub-domain names).

You will need to make your subdomains in your DNS. Technically, you can program this in to the Application_Start, but you should evaluate which list you'll have after which just get the job done to produce them once. Alternatively, find out if your DNS and webhost can perform wildcard domain names to ensure that *.domainname.com will see your website.

After you accomplish that, Maarten Balliauw's blog comes with an article regarding how to route subdomains: http://blog.maartenballiauw.be/publish/2009/05/20/ASPNET-MVC-Domain-Routing.aspx