处理Asp.net Ajax框架12029,12007错误

  <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <script language="javascript" type="text/javascript">
   Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
   function EndRequestHandler(sender, args)
   {
  
   if (args.get_error() != undefined)
   {
   if ((args.get_response().get_statusCode() == '12007') || (args.get_response().get_statusCode() == '12029'))
   {
  
  
   document.writeln("服务器连接失败。");
   window.onerror = false; //JS中遇到脚本错误时不做任何操作
   }
   }
   }
   </script>