Friday, November 26, 2010

ASP.NET MVC 2 Error rised using RenderAction : The controller for path '/' was not found or does not implement IController.

When I try to use RenderAction in ASP.NET MVC2 view:


<%Html.RenderAction("BrowserVersion", "HomeController"); %>


I got the error below:

The controller for path '/' was not found or does not implement IController.



Code for HomeController:


public class HomeController : Controller
{

[ChildActionOnly]
public ActionResult BrowserName()
{
ViewData["BrowserName"] = Request.Browser.Browser;
return View();
}

}


To get rid of the error the call to RenderAction should be RenderAction("BrowserName", "Home") without the Controller suffix.

1 comment:

Smileyofoz said...

Thank you! This was dogging me for hours.

Cheers!