在web.config里面加入customErrors节
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm" <span style="color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;">mode="On"</span>>
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
</system.web>
</configuration>