mvc route
DESCRIPTION
TRANSCRIPT
![Page 1: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/1.jpg)
ASP.NET MVC ROUTEJason
![Page 2: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/2.jpg)
URL Routing
![Page 3: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/3.jpg)
URLsURL Action
http://example.com/Users/Edit/5 UsersController.Edit(5)
http://example.com/Users/Edit UsersController.Edit()
http://example.com/Users UsersController.Index()
http://example.com HomeController.Index()
![Page 4: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/4.jpg)
Register Routes RouteConfig.cs
Global.asax.cs
![Page 5: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/5.jpg)
Catch-all Example
/example.axd/d1/d2/d3/d4
{resource}.axd/{pathInfo} /example.axd/d1
{resource}.axd/{*pathInfo} /example.axd/d1/d2/d3/d4
![Page 6: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/6.jpg)
Static Routs Example
http://example.com/privacy
![Page 7: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/7.jpg)
Dynamic Routs Example
http://example.com/products/10/buy
![Page 8: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/8.jpg)
Route Constraints - Regex Example
http://example.com/basket http://example.com/checkout
![Page 9: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/9.jpg)
Route Constraints - Regex Example
http://example.com/Product/3
![Page 10: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/10.jpg)
Route Constraints - IRouteConstraint Example
http://example.com/Admin/Log
![Page 11: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/11.jpg)
Route Constraints - IRouteConstraint Custom Route Constraint
![Page 12: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/12.jpg)
Route Namespace Parameters
![Page 13: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/13.jpg)
Routes Collection The order in which you added them to the Routes collection
http://server/application/products/show/bikes
Route 1 is set to {controller}/{action}/{id}
Route 2 is set to products/show/{id}
![Page 14: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/14.jpg)
Route Error Handle NotFoundResult.cs
ErrorController.cs
![Page 15: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/15.jpg)
Route Error Handle
![Page 16: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/16.jpg)
Q&A
![Page 17: Mvc route](https://reader036.vdocuments.us/reader036/viewer/2022082602/5403b8cc8d7f72e04c8b48cc/html5/thumbnails/17.jpg)
REFERENCE MSDN
http://msdn.microsoft.com/zh-tw/library/cc668201(v=vs.100).aspx#how_urls_are_matched_to_routes