Routing is how ASP.NET MVC matches a URI to an action. MVC 5 supports a new type of routing, called attribute routing. As the name implies, attribute routing uses attributes to define routes. Attribute routing gives you more control over the URIs in your web application.Why Attribute Routing?For example, a socially enhanced e-commerce website could have the following routes:{productId:int}/{productTitle}Mapped to ProductsController.Show(int id){username}Mapped to ProfilesController.Show(string username){username}/catalogs/{catalogId:int}/{catalogTitle}Mapped to CatalogsController.Show(string username, int catalogId)
If we want to give route information on the top of action in controller then it is called attribute routing. [Route("customers/orders")] public IEnumerable GetCustomers() { ... }By this routing route config looks clean. Any change on a route for action do not effect other routes.
Routing means how a mvc appilication matches to the action .For the costumize URI we should use attribute routing.For create attribute routing we will set it into App_Start->; WebApiconfig.cs.Then we will set a URI above the action .
go through this linkhttps://blogs.msdn.microsoft.com/webdev/2013/10/17/attribute-routing-in-asp-net-mvc-5/
Routing is how a MVC application matches a URI to an Action. Attribute Routing uses attributes to define routesFor ex:[Route(“books/lang/{lang=en}”)]public ActionResult ViewByLanguage(string lang){return View(“OneBook”, GetBooksByLanguage(lang));}
''