开发者

URL handling in ASP.NET WebForms

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 "l开发者_StackOverflow中文版ocation" (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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜