Using attribute based routing I would like to match the following routes:
~/ ~/Home ~/Home/Index
to HomeController.Index, and this route:
~/Home/Error
to HomeController.Error. Here is my configuration:
[Route("[controller]/[action]")]
public class HomeController : Controller {
[HttpGet, Route(""), Route("~/")]
public IActionResult Index() {
return View();
}
[HttpGet]
public IActionResult Error() {
return View();
}
}
I have tried adding Route("[action]")
, Route("Index")
, and other combinations but still don't get a match for:
/Home/Index
/Home
and/Home/Index
to redirect all requests and bookmarks to/
. – NightOwl888