Errors not being redirected to an Http handler if redirectMode="ResponseRewrite"

Posted by Luk on Stack Overflow See other posts from Stack Overflow or by Luk
Published on 2010-04-22T14:37:52Z Indexed on 2010/05/03 11:48 UTC
Read the original article Hit count: 198

I see similar questions, but it looks like there were due to an unrelated issue.

in 3.5, I have a custom error handler that logs errors and redirects users. My web.config is set up as such:

    <httpHandlers>
                 <add path="error.ashx" type="MySite.Tools.WebErrorLogger, MySite.Tools" verb="*"/>
    </httpHandlers>
    <customErrors mode="On" defaultRedirect="error.ashx"
                  redirectMode="ResponseRewrite">
    </customErrors>

When redirectMode is set to "ResponseRedirect", everything works fine (but Server.GetLastError() being null but that seems to be intended)

However, when using ResponseRewrite, my handler is not called and I see ASP.Net default error pages. Any idea on how I could do this?

(I unfortunately can't use either an aspx page or do my error handling in global.asax due to other constraints)

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about error-handling