开发者

Extension-less URLs: Url Rerwrite or Routing?

I would like to make my ASP.NET web page URLs without .aspx extensions. I can do it in two ways开发者_JS百科, use IIS7 URL Rewrite module or ASP.NET URL Routing. Which method to choose?


Use ASP.NET Routing. It's the most up-to-date and right way to do that, since .NET 4.0.

Read this thorough article regarding the subject written by the MSDN team (go to Which Option Should You Use?).

Routing keeps the request-resource resolution logic within your application, so it's very easy to add application-dependent logic when you need, and it eliminates the need to maintain synchronization between your application and a separate configuration resource.

Quote from the article mentioned above:

  1. If you are developing a new ASP.NET Web application that uses either ASP.NET MVC or ASP.NET Dynamic Data technologies, use ASP.NET routing. Your application will benefit from native support for clean URLs, including generation of clean URLs for the links in your Web pages. Note that ASP.NET routing does not support standard Web Forms applications yet, although there are plans to support it in the future.

  2. If you already have a legacy ASP.NET Web application and do not want to change it, use the URL Rewrite module. The URL Rewrite module lets you translate search engine-friendly URLs into a format that your application currently uses. Also, it lets you create redirect rules that can be used to redirect search engine crawlers to clean URLs.

Also read this thorough answer in SO: IIS URL Rewriting vs URL Routing

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜