I came across an issue tonight where first I didn't have a 404 error page setup and then secondly when the custom errors where setup I wasn't getting the 404 error message page for extensions and extensionless urls.
The first this is to setup custom error in the web.config add this in the system.web section.