????ASP.NET?????????????????????????????????try??catch????????ó???????д????????????????????????????????????try??catch??ü??????????????????????????????????????????????????????t????????????????????????????????????Σ?????????NET???????ó????????????ASP.NET??ó????????????????????????????????????飬???????????????????????????ó????????????????????????????????????????????δ???????????CLR?????????????????????????ó???????漴?????

??????????????????????????????????????????????????????

????????????????????????????????????????????????????????????????????????濼???

????ASP.NET???????????????????λ????漶????ó???????????????????????????????????Page?????Error?????????????????????д???????????????????????δ?????????????HttpApplication???????Error??????????????????ó??????????????

??????漶??????

protected override void OnError??EventArgs e??
{
    Exception ex = Server.GetLastError????;
    if??ex is NotImplementedException??
        Server.Transfer??"errorpages/notImplemented.aspx"??;
    else
        Server.Transfer??"errorpages/apperror.aspx"??;
    Server.ClearError????;
}

???????Server?????GetLastError???????????????????????????????????棬??????????????????????????????ClearError???????

????????????

????????Error??????????????????????????????????ó??????????湲????????????????????????ó???????????????????????????????δ??????????????????漶????????????????????????????????????ó????HttpApplication?????е?Error??????????????????global.asax????????????У???????Application_Error??????

protected override void OnError??EventArgs e??
{
    Exception ex = Server.GetLastError????;
    if??ex is NotImplementedException??
        Server.Transfer??"errorpages/notImplemented.aspx"??;
    else
        Server.Transfer??"errorpages/apperror.aspx"??;
    Server.ClearError????;
}

???????????????

??????δ???????????????????ASP.NET????????????????????????????ó???Web.Config????е?<customErrors>???Σ???????????????г???????

<configuration>
    <system.web>
        <customErrors mode="Off">
        </customErrors>
    </system.web>
</configuration>