Note that there are some explanatory texts on larger screens.

plurals
  1. POStop exception from being thrown for non-existent controller
    primarykey
    data
    text
    <p>Ok, so I am stumped on this issue. I have seen a lot of things that are supposed to resolve this issue, but I am not getting a resolution that can fulfill my requirements.</p> <p>I am using ELMAH to log exceptions and am getting this exception when either a URL with invalid controller or proper controller and invalid action.</p> <pre><code>System.Web.HttpException: The controller for path '/BadController' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController&amp; controller, IControllerFactory&amp; factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) </code></pre> <p>I want to stop this exception from being thrown. I am using custom errors and they work fine, as the application will send to my custom 404 error page. However, the exception still gets logged. </p> <p>I have the <code>[HandleError]</code> attribute decorating all controllers. Is this possible? And if so I would appreciate any help.</p> <p>I have tried, setting a <a href="https://stackoverflow.com/questions/19941/catch-exception-when-non-existant-controller-is-requested">final route that redirects</a>, but it is matching a route previous to that for whatever reason. I have attempted to use a <a href="http://www.colincochrane.com/post/2008/01/ASP-NET-Custom-Errors-Preventing-302-Redirects-To-Custom-Error-Pages.aspx" rel="nofollow noreferrer">httpModule</a>, and clearing in the <code>Application_Error</code> event of the <code>Global.asax</code> file. Nothing is stopping that exceptions.</p> <p>Thanks again for any help! </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload