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 .
Interviews6 answers
What is attribute routing in ASP.NET MVC?
6 Answers
Bidyasagar MishraPosted Jul 8, 2019, 5:10 PM EDT
go through this link
https://blogs.msdn.microsoft.com/webdev/2013/10/17/attribute-routing-in-asp-net-mvc-5/
Madan ShekarPosted Oct 17, 2018, 10:34 PM EDT
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.
MayankPosted Sep 6, 2018, 2:43 AM EDT
Routing is how a MVC application matches a URI to an Action. Attribute Routing uses attributes to define routes
For ex:
[Route(“books/lang/{lang=en}”)]
public ActionResult ViewByLanguage(string lang)
{
return View(“OneBook”, GetBooksByLanguage(lang));
}
Rushyanth ReddyPosted Aug 5, 2018, 6:05 AM EDT
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)
nilesh makadiyaPosted Jul 19, 2018, 5:30 AM EDT
''
Harikrishnan RajandiranPosted May 7, 2018, 5:41 AM EDT

