how can i show the full blown .net exception that may occur on an ajax enabled page. i want it to show like it would if the page wasnt using ajax. This for my QA environment for which i dont have the option to temporarily disable update panel. Also i dont want javascript to handle it as our QA testers are wanting to see the usual full blown asp.net exception.
-
Did you try ScriptManager.AsyncPostBackError event: msdn.microsoft.com/en-us/library/…gbs– gbs2011-04-05 03:00:34 +00:00Commented Apr 5, 2011 at 3:00
-
yeah i looked into that. it just sends the exception through to the client so that you can capture it view javascript. There doesnt seem to be a facility to do a full blown page exception.MakkyNZ– MakkyNZ2011-04-05 14:55:06 +00:00Commented Apr 5, 2011 at 14:55
Add a comment
|
1 Answer
Most likely there is no way to show an exception on classic yellow ASP.NET error page after ajax call. But you can send required information via AsyncPostBackErrorMessage and then replace body of the aspx page by some javascript (and jquery):
$(document).ready(function () {
var manager = Sys.WebForms.PageRequestManager.getInstance();
manager.add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
if (args.get_error() != undefined) {
var errorMessage = args.get_error().message;
args.set_errorHandled(true);
$('body').replaceWith(errorMessage);
}
}
In ScriptManager.AsyncPostBackError you can try to render some html that may emulate yellow screen of death. There is an inspiration how to do that on this page: http://www.codeproject.com/KB/aspnet/ASPNETExceptionHandling.aspx.