Esempio n. 1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            #if !DEBUG
            var lastError = Server.GetLastError();
            Server.ClearError();

            var statusCode = lastError.GetType() == typeof(HttpException) ? ((HttpException)lastError).GetHttpCode() : 500;

            var routeData = new RouteData();
            routeData.Values.Add("controller", "Error");
            routeData.Values.Add("action", "Index");
            routeData.Values.Add("statusCode", statusCode);
            routeData.Values.Add("exception", lastError);

            IController controller = new Controllers.ErrorController();

            var requestContext = new RequestContext(new HttpContextWrapper(Context), routeData);

            controller.Execute(requestContext);
            #endif
        }
Esempio n. 2
0
        protected void Application_Error(object sender, EventArgs e)
        {
#if !DEBUG
            var lastError = Server.GetLastError();
            Server.ClearError();

            var statusCode = lastError.GetType() == typeof(HttpException) ? ((HttpException)lastError).GetHttpCode() : 500;

            var routeData = new RouteData();
            routeData.Values.Add("controller", "Error");
            routeData.Values.Add("action", "Index");
            routeData.Values.Add("statusCode", statusCode);
            routeData.Values.Add("exception", lastError);

            IController controller = new Controllers.ErrorController();

            var requestContext = new RequestContext(new HttpContextWrapper(Context), routeData);

            controller.Execute(requestContext);
#endif
        }