如何在网页中禁用详细的 "Compilation Error" 输出

How to disable detailed "Compilation Error" output in web page

我想禁用在我的 ASP.NET 网站出现错误时显示的详细 [​​=43=] 页面。它显示:

这是我已经尝试过的:

理想情况下,我不想透露编译错误。所以,我想知道:a) 如何禁止显示这些详细信息并显示默认值 and/or b) 如何显示我的自定义错误页面。谢谢。

您可以在 web.config:

中自定义它
<customErrors defaultRedirect="GenericError.htm"
              mode="On">
  <error statusCode="500"
         redirect="InternalError.htm"/>
</customErrors>

更多信息here