A Better Error Page on the Canada Immigration Site

Tonight during the historic US election, the Canadian Immigration site (http://www.cic.gc.ca/) was down. I’m sure it had nothing to do with Americans trying to leave their country and move to Canada in light of the imminent Trump victory. The following ASP.NET error page was displayed:

Screen Shot 2016 11 08 at 10.59.59 PM

This is a default error page that gets displayed for ASP.NET sites. This is ok, but I prefer something more friendly than this type of page which doesn’t mean much for most people. A custom error page should have information about your website and contact info for the user to let you know the site failed.

The code to redirect errors to a custom page is added to the web.config file (located in the root of the website folder). The following settings refers to Error.aspx in the /ErrorPages folder.

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="~/ErrorPages/Error.aspx" />
    </system.web>
</configuration>