Пример #1
0
        public ActionResult MethodNotAllowed()
        {
            this.HttpContext.Response.TrySkipIisCustomErrors = true; // motherfucking helpfull

            var ctrlContext = new ControllerContext();

            ctrlContext.HttpContext = this.HttpContext;
            ctrlContext.RouteData   = MethodNotAllowedRoute;

            IController ctrl = new BaseErrorController
            {
                ControllerContext = ctrlContext,
            };

            ctrl.Execute(new RequestContext(this.HttpContext, ctrlContext.RouteData));

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Shows a 400 page.
        /// </summary>
        public ActionResult BadRequest(string message = null)
        {
            this.HttpContext.Response.TrySkipIisCustomErrors = true; // motherfucking helpfull

            var ctrlContext = new ControllerContext();

            ctrlContext.HttpContext = this.HttpContext;
            ctrlContext.RouteData   = BadRequestRoute;
            if (message != null)
            {
                ctrlContext.RouteData.Values[ResultServiceBase.RouteDataMessageKey]     = message;
                ctrlContext.RouteData.DataTokens[ResultServiceBase.RouteDataMessageKey] = message;
            }

            IController ctrl = new BaseErrorController
            {
                ControllerContext = ctrlContext,
            };

            ctrl.Execute(new RequestContext(this.HttpContext, ctrlContext.RouteData));

            return(null);
        }