How do I return a reasonable error code when using customErrors redirect?

almahuman

New Member
In web.config of my ASP.NET website I have \[code\]customErrors\[/code\] turned on and set to redirect to a specific action in case of HTTP 404: now I start Fiddler and in my browser query some URL that yields HTTP 404. Fiddler clearly shows that first the browser queries that URL and gets HTTP 302 with the path to \[code\]<...>/Error/FileNotFound\[/code\] and queries that and finally receives HTTP 200.So effectively the original HTTP 404 disappears and I get HTTP 302 followed by HTTP 200.Meanwhile if I query some invalid address from StackOverflow (like http://stackoverflow.com/ques/ask) I get HTTP 404 in a single request. I mention this because StackOverflow uses ASP.NET too.How do I use \[code\]customErrors\[/code\] in IIS to get HTTP 404 instead of HTTP 302 followed by HTTP 200?
 
Back
Top