Copied to clipboard

Flag this post as spam?

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


  • Philip Hayton 23 posts 135 karma points
    Oct 26, 2019 @ 14:16
    Philip Hayton
    0

    Return Umbraco 404 from RenderMvcController

    Hi guys,

    Is it possible, and if so how do you return the standard Umbraco 404 error from a RenderMvcController? This beautiful bad boy:

    enter image description here

    In my scenario, I am using a UmbracoVirtualNodeRouteHandler to handle a custom route. A RenderMvcController is responsible for pulling the content from a remote API via ID. If the content doesn't exist, I'd like to return the same 404 page generated by normal Umbraco routing.

    Here's how I'm currently doing it. This returns an IIS error page though.

            var remoteContent = await _service.Get(id);
            if (remoteContent == null) return new HttpNotFoundResult();
    

    Any help is greatly appreciated. TIA!

  • 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