asp.net mvc - Error page in MVC while error occurred from Ajax call -


in mvc application using custom error attribute class inherited handleerrorattribute globally handle exceptions.

my objective :

  1. showing error page while exception occurred.
  2. showing custom error page.

in application of control action method called using ajax.i able show error page when exception occurs controller action ajax call not used in case of ajax call error logged error page not displaying.

set error trap in ajax setup:

 $.ajaxsetup({     error: function(jqxhr, exception) {         if (jqxhr.status === 0) {             alert('not connect.\n verify network.');         } else if (jqxhr.status == 404) {             alert('requested page not found. [404]');         } else if (jqxhr.status == 500) {             alert('internal server error [500].');         } else if (exception === 'parsererror') {             alert('requested json parse failed.');         } else if (exception === 'timeout') {             alert('time out error.');         } else if (exception === 'abort') {             alert('ajax request aborted.');         } else {             alert('uncaught error.\n' + jqxhr.responsetext);         }     } }); 

obviously, can when error caught.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -