0

In one of our MVC controllers we have:

public ActionResult Index()
{
    return HttpNotFound();
}

This HttpNotFound will set the StatusCode to 404. We would like to 'catch' this 404 status code and show a custom 404 page by changing the Context.Item into this custom 404 item.

In what kind of pipeline/processor should we hack in to change the context.item so that we get our nice custom 404 page rendered?

Kr,

3
  • 2
    Did you check before asking? we have dozens of different articles already on 404 handling. google.com/…
    – Mark Cassidy
    Commented Feb 15, 2022 at 10:20
  • Already spent a couple of hours on different ways to get this working ... so yes, did check before asking
    – Centiyo
    Commented Feb 16, 2022 at 8:32
  • Are there any additional suggestions ... ? I'm not able to get this working. I'm able to switch the context.item but the previous item is still rendered. The context.item switch is not picked up appearantly ... probably because i'm too late in the pipelines.
    – Centiyo
    Commented Mar 10, 2022 at 13:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.