Handling 404's better in .NET
<p>As some of you guys are running some pretty big sites I wanted to get your opinion on handling 404’s. I have tried loads of different setups with .Net but can never actually get it to do the right thing. I always seem to get some kind of redirect or false header returned, never a 404. This is a real pain because search engines never get the correct feedback and are still hitting these pages despite them no longer existing. In turn this means I get errors reported for pages I know no longer exist. I’m also pretty confused over the way some requests are handled by .Net and some are handled by IIS. </p>

<p>My current setup is as follows: IIS7, ASP.Net 3.5 App. I have the custom error pages section of web.config setup to handle 404’s using the new redirectMode="ResponseRewrite" property, forwarding to a html error page. IIS is configured to handle 404’s and forward them to the same html page. Elmah is configured to report any such issues via email too. </p>

<p>Now when I try the following address <a href="http://www.severnside.com/document.aspx" rel="nofollow">http://www.severnside.com/document.aspx</a> (a page that doesn’t exist), .net handles the error and shows a 200 response. Obviously this should be a 404. When I try <a href="http://www.severnside.com/document" rel="nofollow">http://www.severnside.com/document</a> I get a correct 404 but the error was handled by IIS. Is it possible to have .Net handle this error too so Elmah can pick up the error?</p>

<p>It would be great if I could get an insight into the setups used by others to handle this sort of scenario correctly. </p>

<p>Thanks</p>
