The controller for path '/' was not found

2019-07-20 01:16发布

问题:

I am trying to call an action in HeaderLinks.cshtml razor view.

@Html.Action("SideMenu","Index")

SideMenuController is in a plugin that i installed on nopCommerce. All routing is good.

routes.MapRoute("Nop.Plugin.Other.SideMenu.Log", "sidemenu/index", new { controller = "SideMenu", action = "Index" }, new[] { "Nop.Plugin.Other.SideMenu.Controllers" });

But the view is showing an error - "The controller for path '/' was not found or does not implement IController."

I also tried with that...

@Html.Action("SideMenu","Index",new { area = "" })

Result is same. What is causing that and how can i get rid of it?

回答1:

I think it's

@Html.Action("Index","SideMenu",new { area = "" })

instead of

@Html.Action("SideMenu","Index",new { area = "" })