public ActionResult Index()
        {
            string messsage = "Unknown error";

            var view = new ErrorModel { Error = messsage };

            return View(view);
        }
        public ActionResult Http500()
        {
            Response.StatusCode = 500;
            var view = new ErrorModel { Error = "Entschuldigung, aber ein interner Fehler ist aufgetreten. Das hätte nicht passieren dürfen. Bitte versuchen Sie es nocheinmal. Sollte der Fehler weiterhin auftreten, kontaktieren Sie bitte den zuständigen Administrator." };

            if(Request.IsAjaxRequest())
                return new EmptyResult();

            return View(view);
        }
        public ActionResult Http404()
        {
            Response.StatusCode = 404;
            var view = new ErrorModel { Error = "Die Ressource '" + HttpContext.Request.Url.ToString() + "' konnte nicht gefunden werden." };

            if(Request.IsAjaxRequest())
                return new EmptyResult();

            return View(view);
        }
        public void OnException(ExceptionContext filterContext)
        {
            if(filterContext.ExceptionHandled)
                return;

            if (filterContext.HttpContext.Request.IsAjaxRequest())
            {
                filterContext.Result = new JsonResult
                {
                    Data = new { success = "false", error = filterContext.Exception.Message },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };

                filterContext.ExceptionHandled = true;

                if(filterContext.Exception is HttpException)
                {
                    HttpException ex = filterContext.Exception as HttpException;
                    filterContext.HttpContext.Response.StatusCode = ex.GetHttpCode();
                }
                else
                {
                    filterContext.HttpContext.Response.StatusCode = 500;
                }

                log.Fatal(filterContext.Exception.Message);

                return;
            }

            if (!filterContext.IsChildAction)
            {
                ErrorModel model = new ErrorModel { Error = filterContext.Exception.Message };

                filterContext.Result = new ViewResult
                {
                    ViewName = "Error",
                    ViewData = new ViewDataDictionary<ErrorModel>(model),
                    TempData = filterContext.Controller.TempData
                };
                filterContext.ExceptionHandled = true;

                if (filterContext.Exception is HttpException)
                {
                    HttpException ex = filterContext.Exception as HttpException;
                    filterContext.HttpContext.Response.StatusCode = ex.GetHttpCode();
                }
                else
                {
                    filterContext.HttpContext.Response.StatusCode = 500;
                }

                log.Fatal(filterContext.Exception.Message);

                return;
            }
            else
            {
                ErrorModel model = new ErrorModel { Error = filterContext.Exception.Message };

                filterContext.Result = new ViewResult
                {
                    ViewName = "ErrorI", //a ascx file
                    ViewData = new ViewDataDictionary<ErrorModel>(model),
                    TempData = filterContext.Controller.TempData
                };
                filterContext.ExceptionHandled = true;

                if (filterContext.Exception is HttpException)
                {
                    HttpException ex = filterContext.Exception as HttpException;
                    filterContext.HttpContext.Response.StatusCode = ex.GetHttpCode();
                }
                else
                {
                    filterContext.HttpContext.Response.StatusCode = 500;
                }

                log.Fatal(filterContext.Exception.Message);

                return;

                //Alternate - return nothing
                //filterContext.Result = new EmptyResult();
                //filterContext.ExceptionHandled = true;
            }
        }