【发布时间】:2015-06-22 08:33:58
【问题描述】:
我有 ASP.NET 网站,我正在尝试为运行时错误和 404 错误(找不到页面)制作错误页面。我在 web.config 页面中有此代码。
<customErrors mode="On" defaultRedirect="~/Error.aspx">
<error statusCode="404" redirect="~/404.aspx"/>
</customErrors>
当我尝试以http://localhost:63629/notexist.aspx 输入一些不存在的页面时,我得到了 404.aspx 页面,但是当我输入 http://localhost:63629/notexist(没有 .aspx)时,我从浏览器中得到了默认错误页面。 我该如何解决?
【问题讨论】:
-
浏览器将其视为目录而不是页面。
-
如何将其添加到 404.aspx 重定向?
标签: asp.net error-handling http-status-code-404