<p>I want to be able to capture the exception that is thrown when a user requests a non-existent controller and re-direct it to a 404 page. How can I do this?</p>

<p>For example, the user requests <code>http://www.nosite.com/paeges/1</code> (<em>should be</em> <code>/pages/</code>). How do I make it so they get re-directed to the 404 rather than the exception screen?</p>

[{'answer_id': 19949, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 4, 'selected': True, 'text': '<p>Take a look at <a href="http://richarddingwall.name/2008/08/09/three-common-aspnet-mvc-url-routing-issues/" rel="noreferrer">this page</a> for routing your 404-errors to a specified page.</p>\n'}, {'answer_id': 19959, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 4, 'selected': False, 'text': '<p>Just use a route:</p>\n\n<pre><code>// We couldn\'t find a route to handle the request.  Show the 404 page.\nroutes.MapRoute("Error", "{*url}",\n    new { controller = "Error", action = "404" }\n);\n</code></pre>\n\n<p>Since this will be a global handler, put it all the way at the bottom under the Default route.</p>\n'}, {'answer_id': 19966, 'author': 'jmcd', 'author_id': 2285, 'author_profile': 'https://Stackoverflow.com/users/2285', 'pm_score': 1, 'selected': False, 'text': '<p>Found this on the same site - <a href="http://richarddingwall.name/2008/08/17/strategies-for-resource-based-404-errors-in-aspnet-mvc/" rel="nofollow noreferrer">Strategies for Resource based 404s</a></p>\n'}]
['https://Stackoverflow.com/questions/19941', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2285/']