The situation I have is I am handling OnException in my controller. Depending on the type of exception I would like to return a javascript result. The action method that threw the exception was called by submitting an ajax form. The ajax form handles the success event. In my OnException method I am setting ExceptionHandled = true per all the examples I’ve seen. The problem is even though an exception was thrown and I returned a JavascriptResult the success method is called and the javascript I returned isn’t executed. Any suggestions as to why this is happening and how I can get the JavascriptResult to execute.
Share
Here’s the sequence of events:
Your options are:
Set a status code of 500 on the response before returning from OnException. The browser will call OnComplete, then OnFailure.
Deal with the returned value in OnComplete, instead of in OnSuccess, and then return false to indicate OnSuccess should not be called.