protected override void OnException(ExceptionContext filterContext) { Exception e = filterContext.Exception; var logger = new DatabaseLogger(); filterContext.ExceptionHandled = true; if (e is NotificationException) { logger.Info(filterContext.Exception.Message); filterContext.Result = new ViewResult { TempData = new TempDataDictionary { { string.Format("MyFramework.notifications.{0}", NotifyType.Error), e.Message } }, ViewData = new ViewDataDictionary(filterContext.Result) }; } else if (e is SecurityException) { logger.Error(filterContext.Exception.Message); filterContext.Result = new ViewResult() { ViewName = "NoAuthorize", ViewData = new ViewDataDictionary(e) }; } else { logger.Error(filterContext.Exception.Message); filterContext.Result = new ViewResult() { ViewName = "Error", ViewData = new ViewDataDictionary(e) }; } }