Mvc route

382
-1

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
382
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
14
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Mvc route

  1. 1. Jason ASP.NET MVC ROUTE
  2. 2. URL Routing
  3. 3. URLs URL 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()
  4. 4. Register Routes  RouteConfig.cs  Global.asax.cs
  5. 5. Catch-all  Example  /example.axd/d1/d2/d3/d4  {resource}.axd/{pathInfo}  /example.axd/d1  {resource}.axd/{*pathInfo}  /example.axd/d1/d2/d3/d4
  6. 6. Static Routs  Example  http://example.com/privacy
  7. 7. Dynamic Routs  Example  http://example.com/products/10/buy
  8. 8. Route Constraints - Regex  Example  http://example.com/basket  http://example.com/checkout
  9. 9. Route Constraints - Regex  Example  http://example.com/Product/3
  10. 10. Route Constraints - IRouteConstraint  Example  http://example.com/Admin/Log
  11. 11. Route Constraints - IRouteConstraint  Custom Route Constraint
  12. 12. Route Namespace Parameters
  13. 13. 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}
  14. 14. Route Error Handle  NotFoundResult.cs  ErrorController.cs
  15. 15. Route Error Handle
  16. 16. Q&A
  17. 17. REFERENCE  MSDN  http://msdn.microsoft.com/zh- tw/library/cc668201(v=vs.100).aspx#how_urls_ar e_matched_to_routes
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×