问题的defaultRedirect中的Web.Config<&的customErrors GT; [英] Problem with defaultRedirect in Web.Config <customErrors>

查看:253
本文介绍了问题的defaultRedirect中的Web.Config<&的customErrors GT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Asp.net 4。

I use Asp.net 4.

下面设置我的web.config文件。

Here setting for my Web.Config file.

    <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/ErrorPages/Oops.aspx">
        <error statusCode="404" redirect="/ErrorPages/404.aspx" />
    </customErrors>

我需要应用的的defaultRedirect网址任何例外并使用 redirectMode =ResponseRewrite仅供找不到网页404

通过此刻我能正确地管理这个设置页面未找到(我能得到404.aspx页),但如果任何其他页面上出现异常,我得到了互联网Explorer无法显示该网页,我不能够达到的defaultRedirect Oops.aspx

With this setting at the moment I can manage properly the Page Not Found (I'm able to get the 404.aspx page) but if an Exception arise on any other page I get the "Internet Explorer cannot display the webpage" and I'm not able to reach the defaultRedirect Oops.aspx.

我在做什么在这里错了吗?谢谢

What I'm doing here wrong? Thanks

推荐答案

与具有aspx页面作为自定义错误重定向目标的一个问题是错误的是不特定的页面(在Global.asax中如错误;错误处理的web.config)也将被目标页面,这可能会导致无限重定向循环被抛出

One problem with having an aspx page as the target of a custom errors redirect is that errors that aren't specific to a page (e.g. errors in global.asax; errors processing web.config) will also be thrown by the target page, which can result in an infinite redirect loop.

由于这个原因,它往往是最好有一个静态的HTML页面的至少defaultRedirect中。

For this reason, it's often better to have a static html page as the target of at least the defaultRedirect.

这篇关于问题的defaultRedirect中的Web.Config&LT;&的customErrors GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆