В MVC5 вы можете установить маршрут по умолчанию, используя следующий атрибут на контроллере?
[Маршрут("{action=index}")]
Что эквивалентно этому в MVC6?
Обновить
Это код, который у меня был в MVC5
[Route("{action=index}")]
public class StaticPagesController : Controller
{
public ActionResult About()
{
return View();
}
public ActionResult Contact()
{
return View();
}
public ActionResult Index()
{
return View();
}
}
Я не смог понять, как сделать эквивалент в MVC6, но мне удалось получить ту же функциональность, используя следующее:
[Route("[action]")]
public class StaticPagesController : Controller
{
public ActionResult About()
{
return View();
}
public ActionResult Contact()
{
return View();
}
[Route("/[action]")]
[Route("/")]
public ActionResult Index()
{
return View();
}
}