I am trying to call a controller action defined in an external assembly but application always returns that the resource is not found. the controller is trivial and looks like this:
namespace MyExternal.Controllers
{
[HandleError]
public class ProjAdminController : Controller
{
public ActionResult Index()
{
return View();
}
}
}
Then I updated the route to include the optional namespace:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new[] { "MyExternal.Controllers" }
);
However, when I try to invoke the controller and action it doesnt find the controller. I installed the route debugger and it passes the route test , but it doesnt find the controller or stop on my breakpoint. Its probably someting pretty small, but I can’t figure this out. My apologies is this is a dup. turns out the original code had a bug in the naming of the controller class, but the rest of the code works nicely as an example of how to do this.
IMO you should add
areaparameter to the action invocation. It should contains a namespace of that controller.