Inheritance: IHttpHandler
        public override object Execute(ControllerContext controllerContext, IDictionary <string, object> parameters)
        {
            if (controllerContext == null)
            {
                throw new ArgumentNullException(nameof(controllerContext));
            }

            INotFoundController notFound = NotFoundHandler.CreateNotFoundController(controllerContext.RequestContext);

            controllerContext.RouteData.Values["action"] = "NotFound";
            return(notFound.NotFound());
        }
Beispiel #2
0
        static void ExecuteNotFoundControllerAction(ControllerContext controllerContext)
        {
            IController controller;

            if (NotFoundHandler.CreateNotFoundController != null)
            {
                controller = NotFoundHandler.CreateNotFoundController(controllerContext.RequestContext) ?? new NotFoundController();
            }
            else
            {
                controller = new NotFoundController();
            }

            controller.Execute(controllerContext.RequestContext);
        }
        public IController CreateController(RequestContext requestContext, string controllerName)
        {
            try
            {
                var controller = this.factory.CreateController(requestContext, controllerName);
                WrapControllerActionInvoker(controller);
                return(controller);
            }
            catch (HttpException ex)
            {
                if (ex.GetHttpCode() == 404)
                {
                    return(NotFoundHandler.CreateNotFoundController(requestContext));
                }

                throw;
            }
        }