c# - Why isn't my exception handler firing in Sitecore.mvc.Pipelines? -
i trying create nice exception message our public site, overriding "sitecore.mvc.pipelines.mvcevents.exceptions.showaspneterrormessage" modifying sitecore.pipelines config file, so
<mvc.exception patch:source="pipelines.config"> <processor type="northwestern.core.infrastructure.pipelines.exceptionerrorhandler, northwestern.core"/> <processor type="sitecore.mvc.pipelines.mvcevents.exception.showaspneterrormessage, sitecore.mvc" patch:source="sitecore.mvc.config"/> </mvc.exception>
and here exceptionerrorhandler code:
namespace northwestern.core.infrastructure.pipelines { public class exceptionerrorhandler : exceptionprocessor { public override void process(exceptionargs args) { var context = args.exceptioncontext; var httpcontext = context.httpcontext; var exception = context.exception; // return 500 status code , execute custom error page. httpcontext.server.clearerror(); httpcontext.response.statuscode = 500; httpcontext.server.execute("/error-page"); } } }
but, have placed breakpoint inside above code , never hits breakpoint
try add pipeline :
<pipelines> <mvc.exception> <processor type="sitecore.mvc.pipelines.mvcevents.exception.showaspneterrormessage, sitecore.mvc"> <patch:attribute name="type">northwestern.core.infrastructure.pipelines.exceptionerrorhandler, northwestern.core</patch:attribute> </processor> </mvc.exception> </pipelines>