Skip to content Skip to sidebar Skip to footer

How Recognize Javascript Fetch() Inside Handleerrorattribute Onexception?

In an asp.net mvc application, I'm successfully handling exceptions that occur when I make a jquery $.ajax call from javascript to a Controller. I want to handle errors in the sam

Solution 1:

See answer to related question at From server, how recognize javascript fetch() call was made (asp.net mvc). The fix is to send X-Requested-With XMLHttpRequest in the headers:

fetch('/MyDomain/MyControllerAction', { headers: { 'X-Requested-With': 'XMLHttpRequest' } })

Post a Comment for "How Recognize Javascript Fetch() Inside Handleerrorattribute Onexception?"