asp.net 2.0中,怎样在web.config中设置当程序出错时,转到一个自定义的出错页面中,而不是显示asp.net 的那些默认的出错页?就是所有的出错都转到一个页.

解决方案 »

  1.   

    你可以在web.config中定义所有的出错代码都跳转到相同的页面就可以了嘛!!!例如
    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
          <error statusCode="404" redirect="GenericErrorPage.htm" />
        </customErrors>
      

  2.   

    我认为比较好的方法是在global.asax中的Application_Error事件中去捕获错误信息发到自己的邮箱,完了,转向到一个错误页。(这个错误页可以自己定制一下。)
      

  3.   

    就用这个
    <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
          <error statusCode="404" redirect="GenericErrorPage.htm" />
        </customErrors>