While debugging, I cannot display my Error view when an Exception occurs in my controller.
I know I'm missing something here, but cannot figure it out. It never makes it to my ErrorController.
I have a Controller in the Controllers folder called ErrorController.
I can verify the error message in the model variable when it's created.
Here is the exception code in my Controller:
filterContext.ExceptionHandled = true;
var model = new HandleErrorInfo(filterContext.Exception, "Error", "Index");
filterContext.Result = new ViewResult()
{
ViewName = "~/Views/Shared/Error",
ViewData = new ViewDataDictionary<HandleErrorInfo>(model)
};
My Error controller simply looks like this:
public class ErrorController : Controller
{
// GET: ErrorController
public ViewResult Index()
{
return View();
}
}
Can someone tell me what I'm overlooking here?