Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Dec 06, 2011 @ 10:07
    Anthony Candaele
    0

    problem creating custom404 pages for a multilingual website

    Hi,

    I having problems creating custom404 pages for a multilingual website.

    My multilingual websites are built in Umbraco 4.7.1 and run on IIS 7.5

    In the umbracoSettings.config file is configured like this:

    <errors>

                <!-- the id of the page that should be shown if the page is not found -->

                <error404>

                <errorPage culture="nl-BE">1176</errorPage>

                <errorPage culture="fr-BE">1177</errorPage>

                </error404>

                <!--<error404>1</error404>-->            

            </errors>

    But if I enter a fictituous url, instead of my custom 404 pages, I still get the default IIS error 404 page.

    Anyone an idea how I can solve this?

    Thanks for your help,

    Anthony

  • Duncan McDougall 35 posts 62 karma points
    Dec 06, 2011 @ 10:24
    Duncan McDougall
    1

    I found this on SO. Looks like a similar issue. http://stackoverflow.com/questions/6929304/add-custom-404-pages-in-umbraco-4-7

    This guy built himself a custom handler which he provides the code for.

    From the comments Sebastiaan does write that this will be fixed in the next release.

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 06, 2011 @ 10:38
    Anthony Candaele
    0

    Hi Duncan,

    Thanks for the advice. I also saw this post, maybe I should try this solution.

    I already tried using the Multisite Page Not Found handler in uComponents, but this isn't working either.

    greetings,

    Anthony

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 06, 2011 @ 10:46
    Anthony Candaele
    0

    Hi Duncan,

    In that post on SO, Sebastiaan replies that the <errorPage> node should be changed to <error404> so I changed my umbracoSettings.config to:

    <errors>

                <!-- the id of the page that should be shown if the page is not found -->

                <error404 culture="nl-BE">1176</error404>

                <error404 culture="fr-BE">1177</error404>

                <!--<error404>1</error404>-->            

            </errors>

    but it still doesn't work .... sigh

    Anthony

  • Duncan McDougall 35 posts 62 karma points
    Dec 06, 2011 @ 15:45
    Duncan McDougall
    1

    Hi Anthony,

    Could be wrong but I read that as he needed to change the errorPage to error404 in his custom handler for naming convetioning. The custom code is still what he used. If you give it a go let me know. Could be working on a multilingual next week.

    Cheers,

    Duncan

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 06, 2011 @ 16:42
    Anthony Candaele
    0

    Hi Duncan,

    I would love to try this custom handler class, but I'm not that familiar with custom handlers. Where exactly should I put this code in my webfolder, or do I need to create a lokal VS Solution, then compile the class and put in the /bin folder of my live website?

    Thanks for the advice,

    Anthony

  • Duncan McDougall 35 posts 62 karma points
    Dec 08, 2011 @ 00:31
    Duncan McDougall
    0

    Anthony,

    Sorry for the delay. Everything you should need can be found in these two wiki pages.

    http://our.umbraco.org/wiki/how-tos/how-to-implement-your-own-404-handler

    http://our.umbraco.org/wiki/reference/files-and-folders/files-in-the-config-folder/404handlersconfig

    Short answer. You can put it anywhere in your own solution as long as you have your dll in the /bin folder and you reference it in 404handlers.config

    e.g.

    <notFoundassembly="MyLibrary"namespace="MyLibrary.Handlers"type="MyNotFoundHandler"/>

    It's been a few months since I've done this myself but it sound about right.

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 08, 2011 @ 15:24
    Anthony Candaele
    0

    Hi Duncan,

    Thanks for the information.

    Still no white smoke I'm afraid.

    I created a new web application project (Custom404Handler) in VS 2010, created a class (Custom404) and copied the code for a custom 404 handler from Stack Overflow.

    I referenced the necessary dll (interfaces.dll, businesslogic.dll, umbraco.dll) and compiled the class without any issues.

    Then I put the compiled custom404handler.dll in the /bin folder of my live site.

    I put this line in my 404handlers.config

     

    and I configured my umbracoSettings.config like this:

     <errors>

                <!-- the id of the page that should be shown if the page is not found -->

                <error404 culture="nl-BE">1176</error404>

                <error404 culture="fr-BE">1177</error404>

                <!--<error404>1</error404>-->            

            </errors>

    but alas, I'm still getting the default IIS 404 error page.

    greetings,

    Anthony

  • Duncan McDougall 35 posts 62 karma points
    Dec 08, 2011 @ 15:52
    Duncan McDougall
    0

    If you copied the code directly you should try <errorPage culture... instead of <error404>. I think Sebastiaans note was to the guy who wrote the code to change it for consistencies sake.

  • Anthony Candaele 1197 posts 2049 karma points
    Dec 08, 2011 @ 18:03
    Anthony Candaele
    0

    yes!! it works. I followed your last suggestion, and I also changed this line in the 404handlers.config file:

     <notFound assembly="Projectlibrary" type="Custom404Handler"/>

    to

     <notFound assembly="Custom404Handler" type="Custom404"/>

    following this format:

     <notFound assembly="name-of-dll" type="name--of-custom404-class"/>

    Thanks for hanging on Duncan, and I hope this solution will work for your multilangual project too.

    greetings,

    Anthony

  • 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