Esempio n. 1
0
        protected void Application_Error()
        {
            var path = Request.Url.AbsolutePath.ToLower();

            var error = Server.GetLastError();

            Server.ClearError();

            Response.Clear();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.TrySkipIisCustomErrors = true;

            var action = path.StartsWith("/api") ? "ApiError" : "NormalError";

            //HANDLE RESPONSE
            var routeData = new RouteData();

            routeData.Values.Add("controller", "Error");
            routeData.Values.Add("action", action);
            routeData.Values.Add("error", error);

            IController errorController = new Controllers.ErrorController();

            errorController.Execute(new RequestContext(new HttpContextWrapper(this.Context), routeData));
        }
Esempio n. 2
0
        protected void Application_Error()
        {
            var path = Request.Url.AbsolutePath.ToLower();

            var error = Server.GetLastError();

            Server.ClearError();

            Response.Clear();
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.TrySkipIisCustomErrors = true;

            var action = path.StartsWith("/api") ? "ApiError" : "NormalError";

            //HANDLE RESPONSE
            var routeData = new RouteData();

            routeData.Values.Add("controller", "Error");
            routeData.Values.Add("action", action);
            routeData.Values.Add("error", error);

            IController errorController = new Controllers.ErrorController();
            errorController.Execute(new RequestContext(new HttpContextWrapper(this.Context), routeData));
        }