If using IIS Custom Error page, then make sure it is a URL Custom Error page
to an ASP page and use Response.Status to change the code to "404".
If using ASP.Net-specific Custom Error, figure out how to do something
similar within ASP.Net.
The question is mostly not an IIS question since when IIS sends a Custom
Error, it always sends the necessary HTTP Status Code -- but when you use
Custom Error Page generated via some dynamic handler like ASP/ASP.Net, you
are responsible for doing the right thing regarding status code. IIS no
longer owns the request.
Re: Terminology -- HTTP Status Code is NOT the same as "HTTP Header".

Signature
//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//
>I Forgot to tell that I am using ASP.NET
adelscott@gmail.com - 30 Dec 2005 09:37 GMT
Thanks, I found this late this night.
When IIS redirects 404 error to a custom page the QueryString contains
the error # and the page that raised the error. I can check the
QueryString on the default page to know if browser is comming from an
error page or not.
In aspx the code is Response.StatusCode = 404