Declan posted on June 08, 2010 13:01
After updating my site I thought it was about time I added a custom error page. The default, shown below, is not very elegant and something a little nicer was required.

I read a tweet from Vasilis who had done a very nice job on his site at thinkofdesign.com and this prompted me into action.
The first step for me was to create a page named 404 and un-check the option to include this page in the menu. I decided to initially keep it simple and added a Text/HTML module titled "Oops!" saying "The page you are looking for could not be found. Either the page has been removed or the URL has been typed incorrectly."
The next step in the process was to change the Custom Errors entry in IIS.

I tested by entering an invalid page url and my new 404 page popped up as expected.
Several days later I tried it again and was surprised to find the old default page showing up. Google came to my aid where I found this post by Brandon Haynes. This helped solve the problem and further research showed me that I needed to change my web.config.
All that is required is a small change in IIS, a 404 page on your site and a small change to your web.config. Search your web.config file for customErrors and you will find:
<!-- permits errors to be displayed for remote clients -->
<customerrors mode="RemoteOnly" />
Change it to:
<customerrors defaultredirect="~/404.aspx" mode="On">
<error statuscode="404" redirect="~/404.aspx"></error>
</customerrors>
Save your web.config changes and you should have a functioning 404 error page.