asp.net - Update panel, end request handler, no error object? -
all,
when upgraded asp.net 2.0 asp.net 3.5 , in custom end request handler, args.get_error() returns null (i traced way function sys$webforms$pagerequestmanager$_endpostback(error, response), error object null there too). happens on production server, on development machine works, error object. both win 7 machines, iis 7.5.
fyi: on server, log error, , clear via ctx.server.clearerror(); set asyncpostbackerrormessage on script manager.
**update: setting allowcustomerrorsredirect="false" on scriptmanager explicitly resolves issue. **
found on msdn little explanation:
remarks
the asyncpostbackerror event raised when there page error during asynchronous postbacks. how errors on server sent client depends on allowcustomerrorsredirect property, asyncpostbackerrormessage property, , custom errors section of web.config file.
here's client script code handling ajax errors:
mgr.add_beginrequest(function(sender, args) { postbackelem = args.get_postbackelement(); if (typeof(postbackelem) === 'undefined') return; targetpnl = self.gettargetpnl(mgr, postbackelem); $(targetpnl).addclass('updateprogress-started', duration); }); //beginrequest mgr.add_endrequest(function(sender, args) { if (typeof(postbackelem) === 'undefined') return; $(targetpnl).removeclass('updateprogress-started', duration); if (args.get_error() != undefined){ var msg; if (args.get_response().get_statuscode() == '200') { msg = args.get_error().message.replace("sys.webforms.pagerequestmanagerservererrorexception: ", ""); } else { msg = 'an unspecified error occurred.'; // error occurred somewhere other server page } args.set_errorhandled(true); // show error in our custom panel $(self._errtext).text(msg); $(self._errpanel).show(); } }); //endrequest
by setting allowcustomerrorsredirect="false" on scriptmanager explicitly resolves issue.
Comments
Post a Comment