views:

40

answers:

1

What's the best approach to provide URL handling in an ASP.NET application to produce results similar to Craigslist. Specifically, I'm looking to handle something like "newyork.mysite.com" and "california.mysite.com", along with parameters such as "newyork.mysite.com/products/hardware". Based on the "location" (newyork.), my goal is to change the site's look and feel and filter it's data results -- standard stuff I would think.

At the moment, ASP.NET MVC is not an option for the site (from what I've read, this sort of functionality is something that MVC excels at), but I can use .NET 4.0. Also, I was wondering what roles DNS would play in this scenario. Is the subdomain just a wildcard or are there any special considerations I would need to make?

The majority of my web development experience has been internal, intranet applications, so URL handling like this is not something I've ever really needed to do. I'd appreciate any advice (best practices, pitfalls, etc) as to how to approach this.

+1  A: 

You can avail of the ASP.NET 4.0 routing engine to create friendly URLs:

http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx

You can create URLs like:

california.mysite.com/home

california.mysite.com/about

california.mysite.com/products

As regards "california.mysite.com", the "california" part represents a sub-domain. This is set up by adding an A record in your host admin and setting up IIS 7 to recognize it.

IrishChieftain
If you are using .NET 3.5 SP1 (instead of .NET 4.0) then you may find this article helpful: http://msdn.microsoft.com/en-us/magazine/dd347546.aspx
Scott Mitchell