Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Johan Dahlström 33 posts 146 karma points
    Dec 28, 2020 @ 12:23
    Johan Dahlström
    0

    Hijack all requests including 404

    I've replaced Umbraco's default RenderMVCController using the last section here. I would like to return the same view regardless if Umbraco finds a template or not (this view returns a single page app):

    public class DefaultRenderMvcController : RenderMvcController
    {
        public override ActionResult Index(ContentModel model)
        {
            return View("~/Views/DefaultPage/Index.cshtml", model);
        }
    }
    

    Since my document types doesn't have templates (they are managed in the single page app), I get the default Umbraco 404 page.

    How can I make the 404 request end up in my DefaultRenderMvcController? Right now Index() isn't called.

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Dec 29, 2020 @ 10:50
    Huw Reddick
    0

    I don't think you can, the 404 handler has to be a document type in Umbraco.

  • Alex Skrypnyk 6182 posts 24283 karma points MVP 8x admin c-trib
    Jan 08, 2021 @ 11:25
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies