A URL pattern can contain the literal values and variable placeholders (referred as URL parameters). The literals and the placeholders are located in the segments of the URL, which are delimited by the slash (/) character.
In ASP.NET Application, which does not use routing, an incoming request for a URL typically maps to a physical file, which handles the request, such as an .aspx file. For example, a request for http://server/application/Products.aspx?id=4 maps to a file that is named Products.aspx, which contains the code and markup for rendering a response to the Browser. The Web page uses the query string value of ID=4 to determine what type of content to display.
The following table shows valid route patterns and examples of URL requests, which match the patterns.
|
Route definition |
Example of matching URL |
|
{controller}/{action}/{id} |
/Products/show/beverages |
|
{table}/Details.aspx |
/Products/Details.aspx |
|
blog/{action}/{entry} |
/blog/show/123 |
|
{reporttype}/{year}/{month}/{day} |
/sales/2008/1/5 |
|
{locale}/{action} |
/US/show |
|
{language}-{country}/{action} |
/en-US/show |
Typical URL Patterns in MVC Applications
URL patterns for routes in MVC Applications typically include {controller} and {action} placeholders. When a request is received, it is routed to the UrlRoutingModule object and then to the MvcHandler HTTP handler. The MvcHandler HTTP handler determines which controller to invoke by adding the suffix "Controller" to the controller value in the URL to determine the type name of the controller which will handle the request. The Action value in the URL determines, which Action method to call.
The following table shows the default URL patterns and it shows the examples of URL requests, which are handled by the default routes.
|
Default URL pattern |
Examples of matching URL |
|
{controller}/{action}/{id} |
http://server/application/Products/show/beverages |
|
{resource}.axd/{*pathInfo} |
http://server/application/WebResource.axd?d=... |
For IIS 7.0, no file-name extension is needed. For IIS 6.0, you must add the .mvc file-name extension to the URL pattern, as shown in the example, given below:
{controller}.mvc/{action}/{id}

Bhavik PatelPosted Aug 17, 2016, 6:37 PM
Nice
Ritesh SinghPosted Aug 16, 2016, 8:42 AM
Nice