我有一些自定义错误要用于.aspx页面,如:www.domain.com/whateverdfdgdfg.aspx
但是,当不请求.aspx url时,它会导致一个错误(如http://www.domain.com/hfdkfdh4545):
HTTP错误404.0 -找不到您要查找的资源已被删除,其名称已更改,或暂时不可用。
我在我的web.config里有这个:
<customErrors mode="On" defaultRedirect="/error/1" redirectMode="ResponseRedirect">
<error statusCode="404" redirect="/404.aspx" />
</customErrors>404.aspx是存在的,因为当请求不存在的.aspx页面时,上面的内容是工作的.
我还在IIS7中配置了错误页面:状态代码: 404路径: /404.aspx类型:执行URL条目类型:本地
我的网站应用程序池设置为"ASP.NET v4.0“
为什么这个还不能用呢?
发布于 2011-05-17 19:39:31
你试过设置以下内容吗?
<system.webServer>
<httpErrors existingResponse="PassThrough" />
</system.webServer>下面是错误页面上的几个引用:
http://www.iis.net/ConfigReference/system.webServer/httpErrors
http://blogs.iis.net/ksingla/archive/2008/02/18/what-to-expect-from-iis7-custom-error-module.aspx
https://webmasters.stackexchange.com/questions/10585
复制相似问题