How to return a view for HttpNotFound() in ASP.Net MVC 3?

前端 未结 6 1049
忘掉有多难
忘掉有多难 2020-11-28 22:47

Is there a way to return the same view every time a HttpNotFoundResult is returned from a controller? How do you specify this view? I\'m guessing configuring a 404 page in

6条回答
  •  孤独总比滥情好
    2020-11-28 23:26

    protected override void HandleUnknownAction(string actionName)
    {
        ViewBag.actionName  = actionName;
        View("Unknown").ExecuteResult(this.ControllerContext);
    }
    

提交回复
热议问题