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>
How will this interact with my ContentLastChanceFinderResolver?
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
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.
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
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
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?
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
Hope this makes sense and helps,
/Dennis
Thank for a quick reply Dennis,
How will this interact with my ContentLastChanceFinderResolver?
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
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.
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
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
I think I solved it.
By replacing this in web.config
With this:
the problem seems solved
is working on a reply...