views:

181

answers:

1

I have an custom IHttpModule that handels all available events and logs the HttpContext.Current.Response.StatusCode to a file.

My web.config does not contain any other module in <httpModules> so all errors are promoted to the browser.

Although the Browsers shows a 404, the log file is full of 200 (Ok) entries and not a single 404.

What am I missing?


Update

An Url ending with .aspx does have a 404 StatusCode in the PreSendRequestHeaders event, but Urls wending with .pdf for example show StatusCode 200 in all events?!

A: 

Is your module actually running when there's a 404?

Have you attached a debugger to the application with a breakpoint in the module - does it get hit at that when you request a non-existant .aspx page? Does it get hit when you request a non-existant file or directory?

Depedning on the set-up of IIS, it's possible that ASP.NET isn't getting a look in with these errors - it's not going to handle a request for somepage.html for example, or missing.gif.

Zhaph - Ben Duguid
Thank you for the hint with the .aspx. I updated the question. Module is running: it logs a bunch of "Eventname+Status+Url" lines.