asp.net
给用户一个统一的处理异常的方法是如下
1。修改web.config
修改完成后代码如下
    <customErrors  mode="On"
 defaultRedirect="WebForm2.aspx"
    />
 2。为全局响应,修改Global.asax
   if (Server.GetLastError() is Exception)
   {
    Server.Transfer("WebForm2.aspx");
   }

3。代码中抛出异常
throw new Exception();

相当的简单是吧

相关文章:

  • 2021-09-27
  • 2022-12-23
  • 2021-05-25
猜你喜欢
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2021-12-22
相关资源
相似解决方案