View Full Version : [CLOSED] Global exception handler

May 06, 2013, 10:52 AM
Hi all,

i need a Global exception handler for asp.net errors and ajaxrequest errors (like for example comunication failure).
My handler must intercept errors and visulize a messagebox with details of error and log to database.
But i do not know how to intercept errors from directevents or directmethods (server side if is possible).


May 06, 2013, 11:36 AM
Please take a look on http://msdn.microsoft.com/en-us/library/w16865z6(v=vs.100).aspx

May 06, 2013, 1:34 PM
Hi Raphael,

thank for your reponse.
But is possible with this sample to intercept errors on ajaxrequest generated by directevents or directmethods?
I would like to emulate ajaxrequestwarningfailure of ext.net and visualize similar messagebox for both, server side and ajaxrequest errors.

May 06, 2013, 3:22 PM
Hi @infonext,

Yes, it should work.

The only thing you might need to set up is

for a ResourceManager or

rethrowAjaxExceptions="true"in the extnet seciton in a Web.config.

Also it is possible to set up via a Session and an Application objects.

Ext.NET uses try/catch block somewhere. To get those exceptions rethrown, it needs to set up that option to true.

May 06, 2013, 10:08 PM
Hi Daniil,

thanks for your reponse. I try to get exception on Page_error (all pages inherits from a base page), but if for example a directevents times out and i get a comunication failure message, the Server.GetLastError() is empty.
How i can know the error type in this case?

May 06, 2013, 10:17 PM
I guess that communication failure is not server side error (it can be timeout issue (timeout in javascript code) or problems with net) therefore such error you will not get on the server side

May 07, 2013, 10:00 AM
Hi Vladimir,

is what i thought (sorry but i aren't very experienced with client side code).
Then if i i wanted to write a global exception handler in javascript for client side errors what strategy should i use?


May 07, 2013, 3:44 PM
You can try with window.onerror.

Also I would try to use a ResourceManager's AjaxRequestException event. It should catch communication failures.

May 08, 2013, 3:18 PM
Hi Daniil,

many thanks.
With AjaxRequestException on listner of ResourceManager i solved my problem.

You can close the thread.