9.21.2012

URL Rewriting vs ASP.NET Routing

Differences between IIS URL Rewriting and ASP.NET Routing
S.No
URL Rewriting
ASP.NET Routing
1
Meaning:
URL rewriting consists of certain regular expression patterns that match an incoming request URL and forward the request to a mapped URL instead. For example, one might create a URL rewriting rule that forwards an incoming request for http://www.example.com/Products/Beverages to another URL of http://www.example.com/Products/Show.aspx?id=5
Meaning:
ASP.NET routing extracts specific values from the URL, based on a pattern. These extracted values can be used to determine the handler that will handle the request. We can also use these patterns to generate a URL that will map to a specific handler.
2
Does it alter the request / incoming URL ?
URL rewriting alters the request URL and forwards it to another URL.
Does it alter the request / incoming URL ?
ASP.NET routing is different. It does not alter the incoming URL.
3
When URL Rewriting is right choice ?
IIS URL rewriting is a generic URL manipulation mechanism that addresses a multitude of scenarios. In particular, it can be used by Web developers as well as Web server/site administrators to enable clean URLs for existing Web applications without modifying the application code.
When ASP.NET Routing is right choice ?
ASP.NET routing is a solution that is optimized for ASP.NET, thus it may be preferable for Web developers who design their ASP.NET applications from the ground up and want to have a clean URL structure.
4
For what type of application(s) URL Rewriting can be used ?
The IIS URL Rewrite module can be used with any type of Web application, which includes ASP.NET, PHP, ASP, and static files.
For what type of application(s) ASP.NET Routing can be used ?
ASP.NET routing can be used only with .NET Framework-based Web applications.
5
Does it extensible and customizable ?
The URL Rewrite module is not extensible in its current version.
Does it extensible and customizable ?
ASP.NET routing is fully extensible and customizable.

6
What tasks it can perform ?
In addition to rewriting, the URL Rewrite module can perform HTTP redirection, issue custom status codes, and abort requests.
What tasks it can perform ?
ASP.NET routing does not perform these tasks.
7
Application Area:
The IIS URL Rewrite module can make rewriting decisions based on domain names, HTTP headers, and server variables.
Application Area:
By default, ASP.NET routing works only with URL paths and with the HTTP-Method header.
8
IIS pipeline mode or Integrated pipeline mode ?
The IIS URL Rewrite module works the same way regardless of whether integrated or classic IIS pipeline mode is used for the application pool.
IIS pipeline mode or Integrated pipeline mode ?
For ASP.NET routing, it is preferable to use integrated pipeline mode. ASP.NET routing can work in classic mode, but in that case the application URLs must include file name extensions or the application must be configured to use "*" handler mapping in IIS.

Summary:

IIS Rewiting & ASP.NET Routing:
"Either IIS URL rewriting or ASP.NET routing can be used to implement URL manipulation scenarios for your Web application. " - By Ruslan Yakushev

Main advantage of ASP.NET Routing:
"It 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.
Routing works great with traditional webforms." - By Rex M

References:





3 comments: