I am using the latest version of ELMAH.MVC in an ASP.NET MVC4 application. These are registration errors, but I want to display a user error page. So I created ErrorController and ErrorView (see below).
I cannot figure out how to get ELMAH.MVC to go to my custom error page for any exceptions thrown. In addition, I want to show a custom header and an error message. I do not have "customError" in web.config.
I am very grateful for your help in this matter ...
Thanks,
Mike
// ELMAH Configuration <add key="elmah.mvc.disableHandler" value="false" /> <add key="elmah.mvc.disableHandleErrorFilter" value="false" /> <add key="elmah.mvc.requiresAuthentication" value="true" /> <add key="elmah.mvc.allowedRoles" value="ABitOfHelp" /> <add key="elmah.mvc.route" value="elmah" /> // My Error Controller /// <summary> /// Logs errors. /// </summary> public class ErrorController : Controller { /// <summary> /// Logs JavaScript errors. /// </summary> /// <param name="message"></param> [HttpPost] public ActionResult LogJavaScriptError(string message) { ErrorSignal.FromCurrentContext().Raise(new JavaScriptException(message)); ViewBag.Message = message; ViewBag.Title = XXXXX.Shared.Properties.Resources.Title_ErrorInformation; return View("Error"); } } // My Error View
@ {}
<h2>@ViewBag.Title</h2> <h3>@ViewBag.Message</h3>
source share