在ASP.NET中,可以通过配置web.config文件中的
<configuration>
<system.web>
<customErrors mode="On" defaultRedirect="ErrorPage.html">
<error statusCode="404" redirect="NotFoundPage.html" />
<error statusCode="500" redirect="ServerErrorPage.html" />
</customErrors>
</system.web>
</configuration>
在上面的示例中,
在指定的错误页面文件中,可以自定义错误信息的显示内容,例如可以显示错误码、错误消息等信息,以便更好地提示用户发生了错误。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
推荐阅读:asp.net过滤器如何自定义错误