Sys.WebForms.PageRequestManagerServerErrorException: (status code was 12029)

 

Sys.WebForms.PageRequestManagerServerErrorException

 

描述:

An exception has occured on the server:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12029

概述:出现此错误的原因一般是:服务器不可达。例如网络没有连接好,服务器故障等等,而不是程序出错。状态代码的含义为:

12029: ERROR_INTERNET_CANNOT_CONNECT   The attempt to connect to the server failed.12007: ERROR_INTERNET_NAME_NOT_RESOLVED  The server name could not be resolved.

 

在endRequest的事件处理器中捕捉此状态代码:

 参考:http://forums.asp.net/t/1129622.aspx

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'))
       
{
        
//Show a Message like 'Please make sure you are connected to internet';
        alert('Please make sure you are connected to internet');
        args.set_errorHandled(
true); 
       }

   }

}

解决方法:

你可能感兴趣的:(Tips,and,Tricks)