A REAL "404 Not Found" response in ASP.NET?
Posted on 2006-05-22
I want to create a 404 page that really sends a "404 Not Found" status that includes custom content.
Problem is that when CustomErrors is on in web.config, the errorhandling actually sends a 302 response and redirects the browser using 'Location: /mycustom404.aspx?aspxerrorpath=/asdffd.aspx' in the header. Problem with this is that I want to send Google et. al. a real "404 Not Found" status, not a "302 Found" status but I also want the page to be user-friendly and not rely on the generic 404 IIS page. I tried putting response.status="404 Not Found" on my custom404.aspx page, but all that does is tell Google that the custom404.aspx page can't be found, not the original.
Anyone have any ideas? I want Google and others to de-index pages that don't exist (thus avoiding possible duplicate content issues) but I don't want stranded users.