404 错误自动转向的问题
昨天在做网站404错误转向的时候,发现了一个问题,aspx的页面怎么也不能转向,多方查找才明白,iis中配置的自定义错误对aspx是无效的,在dotnet的网站中,发生404错误转向在如下地方配置:
<customErrors defaultRedirect="http://www.dic123.com/index.html" mode="RemoteOnly">
<error statusCode="500" redirect="http://www.dic123.com/index.html">
<error statusCode="404" redirect="http://www.dic123.com/index.html">
<error statusCode="403" redirect="http://www.dic123.com/index.html">
</customErrors>
后来测试发现,这样也不能转向,似乎转向的地址不能为其他网站。
修改为:
<customErrors defaultRedirect="\404.htm" mode="RemoteOnly">
<error statusCode="500" redirect="\404.htm">
<error statusCode="404" redirect="\404.htm">
<error statusCode="403" redirect="\404.htm">
</customErrors>
<customErrors defaultRedirect="http://www.dic123.com/index.html" mode="RemoteOnly">
<error statusCode="500" redirect="http://www.dic123.com/index.html">
<error statusCode="404" redirect="http://www.dic123.com/index.html">
<error statusCode="403" redirect="http://www.dic123.com/index.html">
</customErrors>
后来测试发现,这样也不能转向,似乎转向的地址不能为其他网站。
修改为:
<customErrors defaultRedirect="\404.htm" mode="RemoteOnly">
<error statusCode="500" redirect="\404.htm">
<error statusCode="404" redirect="\404.htm">
<error statusCode="403" redirect="\404.htm">
</customErrors>