After trying to setup my site for Google Webmaster Tools I found that my Custom ASP.NET 404 page was not returning the 404 status code. It displayed the correct custom page
I had a similar problem I want to show a custom page as a 404 (which is ASPX) and it worked fine on localhost but as soon as a remote visitor connected they would get the generic IIS 404.
The solution to this was to add
Response.TrySkipIisCustomErrors = true;
Before changing the Response.StatusCode.
Found via Rick Strahl http://www.west-wind.com/weblog/posts/745738.aspx