Copied to clipboard

Flag this post as spam?

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


  • Arjan 21 posts 91 karma points
    Dec 17, 2015 @ 10:59
    Arjan
    0

    404 handled by umbraco, 500 handled by IIS

    Hi guys,

    I'm trying this and cannot get it to work

    Setting up 404 by umbraco is easy, but it needs IIS setting

    However, handling 500 error by IIS requires

    But then the umbraco routing does not work!

    Solution is of course to have IIS reroute 404 to the umbraco page, is rerouting 500 and other error pages planned for umbraco 8? Thanks

  • Matthieu Nelmes 102 posts 385 karma points
    Dec 17, 2015 @ 11:08
    Matthieu Nelmes
    0

    I have a general "Oops" page to handle exceptions/general errors which can be defined in the web.config with:

    <customErrors mode="On" defaultRedirect="~/url-to-your-whoopsie-page"/>
    

    In addition to this, I override the OnApplicationError with my own Global.cs and with this I log the error and email an Administrator. This might be a bit overkill for a standard website, but I'm working with ecommerce booking systems so I like to keep tabs on these things.

    Then I catch 404's and redirect with a setting in the umbracoSettings.config:

    <errors>
          <error404>[NODE ID OF CONTENT PAGE]</error404>
    </errors>   
    
  • Arjan 21 posts 91 karma points
    Dec 17, 2015 @ 11:24
    Arjan
    0

    Matthieu thanks,

    regarding IIS config there is some confusion whether the current (IIS7+) best practice is use the CustomErrors tag or the httpErr tag.. Currently we work with customErrors mode="On" with all other setting in httErr tag

    Internet shows (to me) that CustomError tag is deprecated?

  • Matthieu Nelmes 102 posts 385 karma points
    Dec 17, 2015 @ 11:32
    Matthieu Nelmes
    1

    I've just realised I pasted my dev settings, customErrors should have been On not off! (now edited)

    Anyhow, I haven't come across anything that suggests customErrors has been deprecated? I'd be keen to read up on that if you have any links.

    As to best practices I've just used what I know works but I'm happy to adjust if I find a better alternative :)

  • Nik 1612 posts 7258 karma points MVP 7x c-trib
    Dec 17, 2015 @ 12:05
    Nik
    1

    Hi Arjan,

    Although this doesn't relate directly to Umbraco, I happened to come across this today. http://benfoster.io/blog/aspnet-mvc-custom-error-pages

    It discusses how best to make sure errors are handled with the correct response types and uses a combination of both CustomerErrors and HttpError tags.

    In relation to 500 errors, personally I can't see how Umbraco can handle them. a 500 error is generally a server error and in my experience so far, when this happens it is because the website has fallen over to some degree. I.e. Umbraco isn't able to run/resolve the issue so it would always fall back to IIS to handle.

    Nik

  • Carl Bussema 38 posts 140 karma points
    Dec 17, 2015 @ 15:09
    Carl Bussema
    1

    So the TL;DR version is that you still need both the

Please Sign in or register to post replies

Write your reply to:

Draft