Yeah, right..what you have is the way to do here...
I modified the code a bit here:
[RoutePrefix("Home")]
[Route("{action}")]
public class HomeController
{
[Route("~/")] // GET /
[Route] // GET /Home
[Route("Index")] // GET /Home/Index
public ActionResult Index() {}
public ActionResult ...
}
Some details:
1. Your first case is not exactly the same as conventional routing as in this case you have a literal segment Home
which is not similar to the conventional routing optional of {controller}/{action}/{id} and controller = Home, action=Index,id=optional
.
2. Your second case is expected as by design if a Route
attribute is used on action the attributes on Controller do not take effect.