'Priority between convention routing and attribute routing

Which relation between priority of convention routing and attribute routing exist in dot net core? For instance, if both convention routing and attribute routing have been introduced in the project, which one would apply first on the root of example.com?

consider:

[Route("{controller=user}/{action=login}}")]
public class MyBaseController : Controller
{

}
   
public class HomeController : MyBaseController 
{
   public IActionResult Index()
   {
      return View()
   }
}

public class UserController : MyBaseController 
{
   public IActionResult Login()
   {
      return View()
   }
}

and in Startup also have been defined:

app.UseEndpoints(options => {
   options.MapControllerRoute("default","{controller=home}/{action=index}")
}

Root of the site would be /user/login or /home/index?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source