protected override void OnException(ExceptionContext exceptionContext) { promotalkEntities db = new promotalkEntities(); if (!exceptionContext.ExceptionHandled) { AppErrorLog oAppErrorLogs = new AppErrorLog(); oAppErrorLogs.ErrorMsg = exceptionContext.Exception.Message; ViewBag.msg = exceptionContext.Exception.Message; oAppErrorLogs.datelog = BaseUtil.GetCurrentDateTime(); db.AppErrorLogs.Add(oAppErrorLogs); db.SaveChanges(); exceptionContext.ExceptionHandled = true; Response.Redirect("~/Views/Shared/Error.cshtml"); } }