문제

My controller is "/Home/Index".I want, when i type url to "/Dashboard/Index" or "example.com/Dashboard" my "/Home/Index action method" executed. Can you give me starting point?

도움이 되었습니까?

해결책

Just add this route to your route config. Make sure to add it before the default route:

routes.MapRoute(
    name: "HomeRoute",
    url: "Dashboard/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top