Routing or rewriting, MVC missing link!

Pick Language to Auto Translate:
AR | BG | CA | CS | DA | DE | EL | ES | FI | FR | HI | HR | ID | IT | IW | JA | KO | LT | LV | NL | NO | PL | PT | RO | RU | SK | SR | SL | SV | TL | UK | VI | ZH | ZH-TW

For an MVC pattern to work it needs some form of URL processing whether it is via routing or URL rewriting. Most of the MVC framework that I encountered are depend on URL rewriting rules. But URL rewriting rules requires additional layer like URL rewrite module for apache or ISAPI Rewrite dll for IIS. Needless to say, it makes troubleshooting more complex!

Routing differs from URL rewriting schemes. URL rewriting processes incoming requests by actually changing the URL before it sends the request to the Web page.

For example, an application that uses URL rewriting might change a URL from /Page/ID/ to /Page.php?id=4.

With routing, the URL is not changed when an incoming request is handled, because routing can extract values from the URL. When you have to create a URL, you pass parameter values into a method that generates the URL for you. To change the URL pattern, you change it in one location, and all the links that you create in the application that is based on that pattern will automatically use the new pattern.

The URL patterns that you define are known as routes. In a route, you specify placeholders that are mapped to values that are parsed from the URL request. You can also specify constant values that are used for matching URL requests.

The following list shows valid route patterns and examples of URL requests that match the patterns.

Route definition --> Example of matching URL

{controller}/{action}/{id} --> /Products/show/beverages

{table}/Details.php --> /Products/Details.php

blog/{action}/{entry} --> /blog/show/123

{reporttype}/{year}/{month}/{day} --> /sales/2008/1/5

{locale}/{action} --> /en-US/show

{language}-{country}/{action} --> /en-US/show

May be? Is it?