Copied to clipboard

Flag this post as spam?

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


  • Rasmus Østergård 19 posts 81 karma points c-trib
    Apr 13, 2016 @ 13:31
    Rasmus Østergård
    0

    How to get rid of "This page is intentionally left ugly"

    I've implemented af IContentFinder and added it as a ContentLastChanceFinderResolver. Just like it's explained here: https://our.umbraco.org/documentation/reference/routing/request-pipeline/icontentfinder

    This works flawless!!

    %25c3

    But for certain url's I still see the "This page is intentionally left ugly" system 404 page.

    Ex: http://mysite.com/test%25c3

    On umbraco.com just a blank page is returned: https://umbraco.com/test%25c3

    How do I get this behaviour?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Apr 13, 2016 @ 13:36
    Dennis Aaen
    1

    Hi Rasmus,

    They way that you can do is to create a document type called 404 page, and don´t inherit from your master template, so the 404 template should just be alone.

    Then you create a page using the 404 document in your content tree. When you have done this add the id of the page, to the /config/umbracoSettings.config.

    In case of a 404 error (page not found) Umbraco can return a default page instead. this is set here. Notice you can also set a different error page, based on the current culture so a 404 page can be returned in the correct language

    <errors>
        <!-- the id of the page that should be shown if the page is not found -->
        <!-- 
        <error404>
            <errorPage culture="default">1</errorPage>
            <errorPage culture="en-US">200</errorPage>
        </error404>
        -->
        <error404>1</error404>
    </errors>
    

    Hope this makes sense and helps,

    /Dennis

  • Rasmus Østergård 19 posts 81 karma points c-trib
    Apr 13, 2016 @ 13:43
    Rasmus Østergård
    0

    Thank for a quick reply Dennis,

    1. How will this interact with my ContentLastChanceFinderResolver?

    2. Since the id will differ on the different environments (eg when using Uaas) - i preffer to use the IContentFinder to look up the id at runtime instead of hardcoding it in a config file

    Regards

  • Rasmus Østergård 19 posts 81 karma points c-trib
    Apr 14, 2016 @ 05:57
    Rasmus Østergård
    0

    PS.

    The method Dennis suggests doesn't work for the http://mysite.com/test%25c3 url. This will still show the "This page is intentionally left ugly" system 404 page.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 14, 2016 @ 06:20
    Jan Skovgaard
    0

    Hi Rasmus

    Since you have implemented your own handler to deal with 404's the approach of setting up a custom 404 page like suggested above will not work.

    Percent signs in url's are not valid and that's why it does not get caught - I'm wondering if the example above is something that happens when the url's for your Umbraco pages are generated or if you're just testing all kind of scenarios directly in the browser?

    All url's generated by Umbraco have a set of predefined characters replaced, which includes empty spaces, which would normally translate to % in the browser if you write for instance http://umbraco.com/this is a test that would be http://umbraco.com/this%20is%20a%20test, which works fine - However if you enter the percentage sign manually then it won't work. This is not Umbraco related but the way that the server works.

    If you have a page in Umbraco called "This is a test" the url will be http://yourdomain.com/this-is-a-test since the empty space/whitespace is replaced with the "-" sign.

    You can see the replacements that are added out of the box in /config/umbracoSettings.config in the

    You can read some suggestions about handling requests with percentage signs in them here http://serverfault.com/questions/257680/properly-handle-iis-request-with-percent-sign-in-url - But as I mentioned this issue is not with Umbraco but with the way IIS handles the request when it has a % sign it.

    I hope this helps :)

    /Jan

  • Rasmus Østergård 19 posts 81 karma points c-trib
    Apr 14, 2016 @ 06:42
    Rasmus Østergård
    0

    Hi Jan, thanks for a great reply.

    To answer your question: I'm just testing all kinds of url's directly in the browser.

    The reason is that the "This page is intentionally left ugly" page allow for cross site scripting attack since it will output what ever you type in the url.

    That means if you add a script tag to the url it'll get executed on the "left ugly" page

  • Rasmus Østergård 19 posts 81 karma points c-trib
    Apr 14, 2016 @ 11:35
    Rasmus Østergård
    1

    I think I solved it.

    By replacing this in web.config

    <httpErrors existingResponse="PassThrough">
              <!--<error statusCode="404" path="/404" responseMode="ExecuteURL" />-->
     </httpErrors>
    

    With this:

    <httpErrors errorMode="Custom" >
      <error statusCode="404" subStatusCode="11" path="/" responseMode="ExecuteURL" />
    </httpErrors>
    

    the problem seems solved



Please Sign in or register to post replies

Write your reply to:

Draft