【发布时间】:2012-12-15 23:34:15
【问题描述】:
我已经设置了自定义 404 并且可以正常工作。但是当我尝试访问一些不存在的文件时,它显示了很好的 ASP.NET 404.0 错误页面。
我尝试添加<error statusCode="404.0" redirect="/notfound/?" />,但它不起作用,因为statusCode 应该是整数。
示例
http://localhost:123/das/dsagfdsa 将重定向到http://localhost:123/notfound/?
http://localhost:123/das/dsagfdsa.png 将保留并显示 404.0 错误。
自定义错误部分
<customErrors mode="On" redirectMode="ResponseRedirect" defaultRedirect="/notfound/?">
<error statusCode="404" redirect="/notfound/?" />
</customErrors>
问题
我如何确保它不仅会在错误的页面请求上而且在错误的文件请求上重定向到/notfound/?
【问题讨论】:
标签: asp.net asp.net-mvc iis asp.net-mvc-4 web-config