Best way to implement a 404 in ASP.NET

Posted by Ben Mills on Stack Overflow See other posts from Stack Overflow or by Ben Mills
Published on 2009-03-20T17:01:41Z Indexed on 2010/05/31 5:32 UTC
Read the original article Hit count: 326

I'm trying to determine the best way to implement a 404 page in a standard ASP.NET web application. I currently catch 404 errors in the Application_Error event in the Global.asax file and redirect to a friendly 404.aspx page. The problem is that the request sees a 302 redirect followed by a 404 page missing. Is there a way to bypass the redirect and respond with an immediate 404 containing the friendly error message?

Does a web crawler such as Googlebot care if the request for a non existing page returns a 302 followed by a 404?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about http-status-code-404