/// <summary> /// Contains logic of last error displaying /// </summary> /// <returns></returns> public virtual ActionResult ErrorDetails() { //In the session we store last user error and do not delete it ErrorDetailsModel model = this.Session[ErrorSessionKey] as ErrorDetailsModel; if(model == null) { model = new ErrorDetailsModel(); model.DisplayMessage = "Last error details were not found"; } else { if (!model.IsLogged) { this.Logger.WriteError(model.Exception, model.Message, false, model.UserID); model.IsLogged = true; } //this exception occured when if (model.Exception != null && model.Exception is System.Web.Mvc.HttpAntiForgeryException) return this.RedirectToHomePage(); } return this.View("ErrorDetails", model); }
/// <summary> /// Redirects to the Home page. /// </summary> /// <returns>The Home page view.</returns> protected virtual ActionResult RedirectToErrorPage(ErrorDetailsModel model = null) { if (model != null) { if (!model.IsLogged) { this.Logger.WriteError(model.Exception, model.Message, model.IsFatal, model.UserID); model.IsLogged = true; } this.Session[ErrorControllerBase.ErrorSessionKey] = model; } return this.RedirectToPage("ErrorDetails", "Error"); }