1

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.

2
  • Did you try ScriptManager.AsyncPostBackError event: msdn.microsoft.com/en-us/library/… Commented 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. Commented Apr 5, 2011 at 14:55

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.