0

I am using Asp.Net's AJAX implementation and need to do two additional things when an unhandled exception occurs:

  • Log any unhandled exceptions using ELMAH
  • Return a message back to the page

I am inserting the AJAX script into the page using the following code:

        ClientScriptManager cm = Page.ClientScript;
        String cbReference = cm.GetCallbackEventReference(this, "arg",
            "receiveData", "");
        String callbackScript = "function sendData(arg, context) {" +
            cbReference + "; }";
        cm.RegisterClientScriptBlock(this.GetType(),
            "sendData", callbackScript, true);

How do I configure it so that it also accounts for unhandled exceptions? Btw, ELMAH is already installed on my website and correctly logs exceptions from regular postbacks.

Thanks.

TheGateKeeper
  • 4,420
  • 19
  • 66
  • 101

1 Answers1

0

I looked into things a little further and it seems that responses are being sent and the exceptions are being logged, but not all of them. I haven't figured out the exact criteria for logging, but exceptions generated by ASP.NET are being logged while exceptions generated by myself are not (ie. create and throw).

Hope this helps someone.

TheGateKeeper
  • 4,420
  • 19
  • 66
  • 101