I would like to make my ASP.NET web page URLs without .aspx extensions. I can do it in two ways, use IIS7 URL Rewrite module or ASP.NET URL Routing. Which method to choose?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
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.
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