咱们能够经过配置Web.config让应用程序无论在什么时候何地引起了异常均可以显示统一的友好错误信息。在Web.config文件中的<system.web>节点下添加以下子节点:html
<system.web> ... <customErrors mode="On" defaultRedirect="/Content/RangeErrorPage.html"/> </system.web>