Recently, I had to implement a dynamic custom 404 error page in an ASP.NET MVC2 website. My first instinct was to turn CustomErrors mode on and setup a 404 Error, but this failed to return my custom error page in a shared hosting environment and instead displayed the default IIS 404 page. I'll walk you through fixing this in just a minute, but for now I want to show you how to create the custom 404 page.
More...