Server-side ASP.Net Ajax exception handling

[亡魂溺海] 提交于 2019-11-27 18:29:23

问题


I am using ASP.net's AJAX framework and I am trying to do some exception logging on the javascript-called webservice.

Looking through the web, I find some people handling them client-side and sending them back to the server. I'd prefer not doing that since it relies on an other server call (if it failed the first time, sending an other request doesn't look like a good idea and that makes me change all my calls)

I see some other people decorating all their methods with try... catch blocks (which leads to duplicate error handling, and yet an other try catch block).

However, I'm trying to achieve something similar to global.asax's Application_Error() which handles every uncaught exception (nope, it doesn't seem to be called for AJAX called methods exceptions).

Is that even possible?


回答1:


Use ELMAH - it can capture ajax errors.



来源:https://stackoverflow.com/questions/785585/server-side-asp-net-ajax-exception-handling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!