Routing
When request is received from the browser, it is routed to URL routing module object which transfers request to MVCHttpHandler.
MVCHttpHandler is responsible to map incoming request with controller, action & parameter to action if any.
Route table gets created in global.asax
Route table is created during Application_Start event.
Route function in Global.asax
URL pattern consists of literal & placeholders where placeholders are separated by ' / ' & defined by { placeholder name }
Example :
1) www.myweb.com/products/show/computer
This process works like dictionary where key are placeholder names.
Here keys are {controller} / {action} / {id}
values are product / show / computer
2) http://localhost/home/index
We are targeting home controller & index action.
This is defined by adding an entry into the 'routes' collection using 'MapRoute' function
- ASP.NET MVC uses System.Web.Routing facility to give us clean URL.
- Syntax :
0 comments: