【发布时间】:2020-01-27 07:40:18
【问题描述】:
我创建了一个 404.html 页面并将其设置在错误文档中。它适用于除 aspx 页面之外的所有内容。我怎样才能重定向这些页面呢? 谢谢
【问题讨论】:
标签: iis http-status-code-404 custom-errors
我创建了一个 404.html 页面并将其设置在错误文档中。它适用于除 aspx 页面之外的所有内容。我怎样才能重定向这些页面呢? 谢谢
【问题讨论】:
标签: iis http-status-code-404 custom-errors
据我所知,如果你想在 asp.net web 表单应用程序中显示自定义 404 错误,你应该使用 asp.net 自定义错误页面而不是 IIS 错误页面。
关于如何设置,你可以参考下面的配置。
<system.web>
<customErrors mode="On" >
<error statusCode="404" redirect="error.html"/>
</customErrors>
</system.web>
注意:error.html 应该放在您的 asp.net 网络应用程序的根路径中。
更多细节,您可以参考以下文章:
【讨论】: