日期:2014-05-18  浏览次数:20377 次

错误页面跳转问题
我想网站一报错就跳转的自己定义的页面 error.html
可以我配置了 web.config 文件
 <customErrors defaultRedirect="~/error.html" mode="RemoteOnly">
</customErrors>
输入网站
http://www.szhorn.com/sd  
这里的文件是不存在的,
我怎么才能不管他输入什么东西,只要是报错了了,就跳到 error.html 页面呢

------解决方案--------------------
在IIS里设置
------解决方案--------------------
<customErrors mode="On" defaultRedirect="~/error.html">
<error statusCode="404" redirect="~/error.html"/>
</customErrors>

由于IIS首先对url进行判断,对于非aspx类型的404,不走这里的,你可以在iis里面的错误页面中,设置404错误指向你的error.html
也就是这里


------解决方案--------------------
正解
探讨

<customErrors mode="On" defaultRedirect="~/error.html">
<error statusCode="404" redirect="~/error.html"/>
</customErrors>

由于IIS首先对url进行判断,对于非aspx类型的404,不走这里的,你可以在iis里面的错误页面中,设置404错误指向你的error……