如何在网页中禁用详细的 "Compilation Error" 输出
How to disable detailed "Compilation Error" output in web page
我想禁用在我的 ASP.NET 网站出现错误时显示的详细 [=43=] 页面。它显示:
- 标题:"Compilation Error"
- 描述
- 编译器错误信息
- 源代码错误(黄色框,详细行号和代码错误以红色突出显示)
- 源文件
- "Show Detailed Compiler Output"
这是我已经尝试过的:
- 在 IIS 的 ASP 图标中,将 "Enable Log Error Requests" 设置为
在站点和应用程序池级别均为 false。
- 在 IIS 的 ASP 图标中,将 "Enable Server-side Debugging" 设置为
在站点和应用程序池级别均为 false。
- 在 IIS 的错误页面图标中,单击 "Edit Feature Settings...",
select "Detailed errors" 在站点和应用程序池级别。
- 在 web.config 文件中,设置 "compilation debug=false"
- 在 web.config 文件中,设置 "customErrors mode=Off"
理想情况下,我不想透露编译错误。所以,我想知道:a) 如何禁止显示这些详细信息并显示默认值 and/or b) 如何显示我的自定义错误页面。谢谢。
您可以在 web.config:
中自定义它
<customErrors defaultRedirect="GenericError.htm"
mode="On">
<error statusCode="500"
redirect="InternalError.htm"/>
</customErrors>
更多信息here。
我想禁用在我的 ASP.NET 网站出现错误时显示的详细 [=43=] 页面。它显示:
- 标题:"Compilation Error"
- 描述
- 编译器错误信息
- 源代码错误(黄色框,详细行号和代码错误以红色突出显示)
- 源文件
- "Show Detailed Compiler Output"
这是我已经尝试过的:
- 在 IIS 的 ASP 图标中,将 "Enable Log Error Requests" 设置为 在站点和应用程序池级别均为 false。
- 在 IIS 的 ASP 图标中,将 "Enable Server-side Debugging" 设置为 在站点和应用程序池级别均为 false。
- 在 IIS 的错误页面图标中,单击 "Edit Feature Settings...", select "Detailed errors" 在站点和应用程序池级别。
- 在 web.config 文件中,设置 "compilation debug=false"
- 在 web.config 文件中,设置 "customErrors mode=Off"
理想情况下,我不想透露编译错误。所以,我想知道:a) 如何禁止显示这些详细信息并显示默认值 and/or b) 如何显示我的自定义错误页面。谢谢。
您可以在 web.config:
中自定义它<customErrors defaultRedirect="GenericError.htm"
mode="On">
<error statusCode="500"
redirect="InternalError.htm"/>
</customErrors>
更多信息here。