Given a PhoneCallListController in /Areas/Contacts/Controllers
And using a pretty standard ControllerFactory
protected override IController GetControllerInstance(System.Web.Routing.RequestContext, requestContext, System.Type controllerType)
{
if (controllerType == null) return base.GetControllerInstance(requestContext, controllerType);
return (IController) ObjectFactory.GetInstance(controllerType);
}
When making a request to http://localhost:2663/PhoneCallList
The controllerType
passed in is
base = {Name = "PhoneCallListController"
FullName = "MyApp.Web.Areas.Contacts.Controllers.PhoneCallListController"
instead of the null that I was expecting. I would expect a 404 to occur, but the runtime is happily serving up an instance of this controller, but then failing because The view 'Index' or its master was not found...
(which makes sense).
By contrast when making a request to http://localhost:2663/AControllerThatDoesntExsit
, I get a null passed in (as expected) and end up with a 404 (also as expected).
Do I have something configured incorrectly? Or is there anything in the requestContext I should look at to make sure that the controller and the area in the request info match?
Thanks!