Since IIS 7, you can define custom error pages using the httpErrors node in Web.config.
This lets you catch errors in a SEO-friendly fashion from both inside (e.g. application exceptions) and outside (e.g. IIS request validation failures) your application without having error-handling code everywhere.
Take a look at Web.config and ErrorsController.cs to learn more.