---
title: "Explain attribute based routing in MVC?"  
description: "Explain attribute based routing in MVC?"  
author: "Anonymous User"  
published: 2019-10-15  
updated: 2020-09-22  
canonical: https://www.mindstick.com/interview/33660/explain-attribute-based-routing-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net mvc", "mvc"]  
reading_time: 1 minute  

---

# Explain attribute based routing in MVC?

Its feature is introduced in MVC 5. In pursuance of that the "Route" attribute, we can define the URL structure. For instance, in the below code we have decorated the "GotoAbout" action with the route attribute. According to the route attribute that the "GotoAbout" can be invoked using the URL structure "Users/about".

```
public class HomeController : Controller
{
       [Route("Users/about")]
       public ActionResult GotoAbout()
       {
           return View();
       }
}
```

## Answers

### Answer by Anonymous User

Its feature is introduced in MVC 5. In pursuance of that the "Route" attribute, we can define the URL structure. For instance, in the below code we have decorated the "GotoAbout" action with the route attribute. According to the route attribute that the "GotoAbout" can be invoked using the URL structure "Users/about".

```
public class HomeController : Controller
{
       [Route("Users/about")]
       public ActionResult GotoAbout()
       {
           return View();
       }
}
```


---

Original Source: https://www.mindstick.com/interview/33660/explain-attribute-based-routing-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
