gpt4 book ai didi

.net - 如果将redirectMode设为=“ResponseRewrite”,则不会将错误重定向到Http处理程序

转载 作者:行者123 更新时间:2023-12-03 07:45:07 25 4
gpt4 key购买 nike

我看到类似的问题,但似乎是由于一个不相关的问题。

在3.5中,我有一个自定义错误处理程序,用于记录错误并重定向用户。我的web.config设置如下:

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

当redirectMode设置为 "ResponseRedirect"时,一切正常(但是Server.GetLastError()为null,但这似乎是有意的)

但是,当使用 ResponseRewrite时,未调用我的处理程序,并且看到ASP.Net默认错误页面。关于如何执行此操作的任何想法?

(不幸的是,由于其他限制,我无法使用aspx页面或在global.asax中进行错误处理)

最佳答案

好吧,我过去曾问过pretty similar question

解决方案是将错误页面转换为静态HTML页面。
当然,动态页面上肯定存在某种错误,但是我找不到它。

关于.net - 如果将redirectMode设为=“ResponseRewrite”,则不会将错误重定向到Http处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2691758/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com