Errors are not redirected to the Http handler if redirectMode = "ResponseRewrite"
I see similar questions, but it looks like they were related to an unrelated issue.
in 3.5, I have my own error handler that logs errors and redirects users. My web.config is configured as such:
<httpHandlers>
<add path="error.ashx" type="MySite.Tools.WebErrorLogger, MySite.Tools" verb="*"/>
</httpHandlers>
<customErrors mode="On" defaultRedirect="error.ashx"
redirectMode="ResponseRewrite">
</customErrors>
If the redirectMode is set to a value "ResponseRedirect"
, everything works fine (but Server.GetLastError () is null, but this seems to be intended)
However, when used, ResponseRewrite
my handler is not called and I see the default ASP.Net error pages. Any idea on how I can do this?
(Unfortunately, I cannot use the aspx page or do error handling in global.asax due to other restrictions)
a source to share
Ok, I have asked a pretty similar question in the past.
The solution turned the error page into a static HTML page.
Of course there must be some error on the dynamic page, but I couldn't find it.
a source to share
I came across the same problem and I found that apparently the reason is in the .ashx file, if you are using normal .aspx it will work, it was for me; im still trying to figure out how to "enable" the .ashx file extension using REsponseRewrite as that would be more logical than using an aspx page in my case. Here's an open thread about this thread:
http://social.msdn.microsoft.com/Forums/it-IT/aspnetit/thread/7b8f5e36-44a8-40ea-bd73-2e99a1fd42dd
a source to share