Most of the time developers code in the action methods. Developers can see the URL structure right upfront rather than going to the “routeconfig.cs” and see the lengthy codes. For instance in the below code the developer can see right upfront that the “GotoForm” action can be invoked by four different URL structure.
This is much user friendly as compared to scrolling through the “routeconfig.cs” file and going through the length line of code to figure out which URL structure is mapped to which action.
public class HomeController : Controller { [Route("Home/About")] [Route("Home/Account Details")] [Route("Home/Our Team")] [Route("Home/About Company")] public ActionResult GotoForm() { return View(); } }
Liked By
Write Answer
What is the advantage of defining route structures in the code?
Join MindStick Community
You have need login or register for voting of answers or question.
Anupam Mishra
07-Feb-2016