Reputation: 6829
I have a few areas in project. In one area I have a page (razor) and in it I have added RenderAction() method.
@{Html.RenderAction("Index", "Forum");}
Application works but when I run in debug mode my code breaks with error on this line (bellow) I press continue and everything works but I must remove this error.
No route in the route table matches the supplied values
In Global.asax I add the following route but it doesn't solve the error.
routes.MapRoute(
"Forum",
"{area}/{controller}/{action}/{id}",
new { area = "Forum", controller = "Home", action = "Index", id = UrlParameter.Optional });
It worked but I don't really understand how???
I added the following code in Global.asax RegisterRoutes() method:
routes.MapRoute(
"Forum", // Route name
"{area}/{controller}/{action}/{id}", // URL with parameters
new { controller = "Forum", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Upvotes: 0
Views: 2277
Reputation: 1038800
Try setting the area
route parameter:
@{Html.RenderAction("Index", "Home", new { area = "forum" });}
Upvotes: 2