I am attempting to render a partial view within the main Shared _Layout.chtml file of my ASP.net MVC 4 project. This simple code is shown below
@{Html.RenderAction("UserMenu", "MyController");}
This all works fine when the user is within the root of the site. However, my project also includes an 'Area' called 'Customers'.
When the user navigates to anywhere within the 'Customers' area of my site an exception occurs on the line above and the debugger basically tells me it cannot find the controller
"The controller for path '/Customers/CustomersHome' was not found or does not implement IController."
The same exception occurs if I use Html.RenderPartial
Interestingly, if I swap out Html.RenderAction for Html.Action, this exception does not occur (although obviously nothing is rendered).
Does anyone know a way round this problem?
Have you tried setting the area to a null string?
@{Html.RenderAction("UserMenu", "MyController", new { area="" });}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With