在web.config中,您可以添加该代码来处理404错误:如何正确处理ASP.NET中的404错误?
<customErrors mode="Off" defaultRedirect="ErrorPage.aspx">
<error statusCode="404" redirect="/Site-Map"/>
</customErrors>
这工作得很好,你可以通过这个网址看看http://www.fundraising.com.au/thisisnotapage
然而,根据该网站http://gsitecrawler.com/tools/Server-Status.aspx响应代码因为这个不存在的页面是200,而不是404。
虽然此页面http://www.nuenergy.com.au/thisisnotapage确实在http://gsitecrawler.com/tools/Server-Status.aspx处显示404并重定向到另一页面。
你如何在ASP.NET中实现更高版本? 我需要的反应是一个404和另一个页面出现。